Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

C | String | Question 6

  • Difficulty Level : Easy
  • Last Updated : 05 Feb, 2013

Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.

int main()
    char str[] = "GeeksQuiz";
    printf("%s %s %s\n", &str[5], &5[str], str+5);
    printf("%c %c %c\n", *(str+6), str[6], 6[str]);
    return 0;

(A) Runtime Error
(B) Compiler Error
(C) uiz uiz uiz
u u u
(D) Quiz Quiz Quiz
u u u

Answer: (D)

Explanation: The program has no error. All of the following expressions mean same thing
Since compiler converts the array operation in pointers before accessing the array elements, all above result in same address.

Similarly, all of the following expressions mean same thing.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!