Advertisements

Search results for static

Example:[1]

            If a storage class is missing in the array definition by default it will be taken to be
          
Option A:

            Automatic
            
Option B:

            External
            
Option C:

            Static
            
Option D:

            Either automatic or external depending on the place of occurrence.
            
Correct Answer: option A
Example:[2]

            What is the output of the following program?
#include <stdio.h>
int func1()
{
  int x = 0;
  x++;
  return x;
}
int func2()
{
  static int y = 0;
  y++;
  return y;
}
void main()
{
  int count = 0,r1,r2;
  for(count = 0; count < 4; count++)
  {
    r1 = func1();
    r2 = func2();
  }
  printf("r1 is:%d,r2 is:%d\n", r1,r2);
}

          
Option A:

            r1 is:1,r2 is:1
            
Option B:

            r1 is:4,r2 is:4
            
Option C:

            r1 is:2,r2 is:2
            
Option D:

            r1 is:1,r2 is:4
            
Correct Answer: option D

 Search Links


 Popular C search MCQs


 Popular C search examples