Thursday, March 2, 2017

C Programming Questions with Explanation

Q:: C programming:::
What will be the output?
void main()
{
         static int i=0;
         if(++i)
        {
                  printf("℅d",i);
                  main();
        }
}

(A) 1,1,1,1...
(B) 0,0,0,0...
(C) 1,2,3,4...
(D) None of these

Answer:: (D)

Explanation:

It will go upto range of integer here we are considering int takes 2 bytes.

1,2,3,4 ...32766,32767,-32768,-32767...-2,-1

No comments:

Post a Comment

Tambola

Tambola Quiz Game 4x4 (Called-Out Answers Highlight Only) Tambola Quiz Game 🎲 (4x4 Grid) - Called Out Answers Highlight O...