Question 9
Back to Exercise
What is the output of the following C program?
#include <stdio.h>
int main(void) {
char s[] = "LearnFrenzy";
char *p = s;
p += 5;
printf("%s %c\n", p, *(s + 1));
return 0;
}
- A Frenzy e Correct
- B LearnFrenzy L
- C nFrenzy e
- D Frenzy L
Correct Answer: Option A
After p += 5, p points to the 6th character, so %s prints from there: "Frenzy". *(s + 1) is s[1], the character 'e'.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!