Programming Languages C Objective
Mar 08, 2013

What will be output of the following c code?

void main()
 {
  int array[3]={5};
  int i;
  for(i=0;i<=2;i++)
  printf("%d ",array[i]);
 }

Choose the correct answer:
A) 5 0 0
B) 5 garbage garbage
C) 5 null null
D) Compiler error
Detailed Explanation

Storage class of an array which initializes the element of the array at the time of declaration is static. Default initial value of static integer is zero.

Discussion (0)

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

Share Your Thoughts
Feedback