retagged by
27,339 views
59 votes
59 votes

Consider the following C program:

#include <stdio.h>
int r() {
       static int num=7;
       return num--;
}
int main() {
       for (r();r();r())
              printf(“%d”,r());
       return 0;
}

Which one of the following values will be displayed on execution of the programs?

  1. $41$
  2. $52$
  3. $63$
  4. $630$
retagged by

9 Answers

0 votes
0 votes
just execute like for loop execution.....

every time function will return n and decrease n to n-1.

Answer-->52
Answer:

Related questions

21 votes
21 votes
3 answers
1
18 votes
18 votes
2 answers
2
Arjun asked Feb 7, 2019
15,505 views
Consider the following C program:#include <stdio.h int main() { int a[] = {2, 4, 6, 8, 10}; int i, sum=0, *b=a+4; for (i=0; i<5; i++) sum=sum+(*b-i)-*(b-i); printf("%d\n"...
14 votes
14 votes
6 answers
3
Arjun asked Feb 7, 2019
13,596 views
Consider the following C program:#include <stdio.h int main() { int arr[]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 5}, *ip=arr+4; printf(“%d\n”, ip ); return 0; }The numb...
13 votes
13 votes
4 answers
4
Arjun asked Feb 7, 2019
9,674 views
Consider the following C program :#include<stdio.h int jumble(int x, int y){ x = 2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n"...