recategorized by
4,806 views
0 votes
0 votes

Which one of the following describes correctly a static variable?

  1. It cannot be initialized
  2. It is initialized once at the commencement of execution and cannot be changed at run time
  3. It retains its value during the life of the program
  4. None of the above
recategorized by

2 Answers

0 votes
0 votes

The correct option is C.

It can be initialized at compile time itself.

It can be changed at runtime.

It retains its value during the life of the program, and most importantly a unique value is retained throughout the program.

0 votes
0 votes

It retains its value during the life of the program

Related questions

1 votes
1 votes
2 answers
1
rishu_darkshadow asked Sep 25, 2017
1,319 views
The output of the program codemain() { int x=0; while (x<=10) for(;;) if(++x%10==0) break; printf(“x=%d”,x); }is :x=1 compilation errorx=20 ...
1 votes
1 votes
2 answers
2
go_editor asked Mar 26, 2020
1,502 views
After $3$ calls of the $c$ function bug ( ) below, the values of $i$ and $j$ will be :int j = 1; bug () { static int i = 0; int j = 0; i++; j++; return (i); }$i = 0, j = ...
1 votes
1 votes
8 answers
3
go_editor asked Mar 26, 2020
2,326 views
Find the output of the following $“C”$ code :Main() { int x=20, y=35; x=y++ + x++; y=++y + ++x; printf (“%d, %d\n”, x, y); }$55, 93$$53, 97$$56, 95$$57, 94$
3 votes
3 votes
2 answers
4