Programming Languages C Objective
Mar 08, 2013

What will be output of following c code?

#include<stdio.h>

int main(){

    int x=123;

    int i={

         printf("c" "++")

    };

    for(x=0;x<=i;x++){

         printf("%x ",x);

    }

    return 0;

}

Choose the correct answer:
A) c++0 1 2 3
B) c++0 1 2 1
C) c++0 2 2 3
D) Compiler error
Detailed Explanation

First printf function will print: c++ and return 3 to variable i.

For loop will execute three time and printf function will print 0, 1, 2 respectively.

 

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback