C Programming · Question 12 · Hard
What will be the output of the following C program?
#include <stdio.h>
int main(void) {
char s[] = "PLACEMENT";
char *p = s + 3;
printf("%s %c", p + 2, *(p + 1));
return 0;
}
- EMENT C
- MENT C
- MENT E
- CEMENT E
Answer and explanation
Answer: C. MENT E
Explanation: In "PLACEMENT", p = s + 3 points to 'C'. p + 2 points to 'M', so %s prints "MENT", and *(p + 1) is 'E'.
Previous: What will be the output of the following C program? · Next: What will be the output of the following C program?
Practise c programming
Try a fresh set of c programming questions with an explanation after every answer, free and without signing up: C Programming practice. Or sit a full placement mock test.
More c programming questions
- What will be the output of the following C program?
- What will be the output of the following C program?
- What will be the output of the following C program?
- What will be the output of the following C program?
- What will be the output of the following C program?
- What will be the output of the following C program?
- What will be the output of the following C program?
- What will be the output of the following C program?
- What will be the output of the following C program?
- What will be the output of the following C program?
More technical & programming practice
Java · Python · Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge