GATE | GATE CS 2012 | Question 48
Consider the following C program
int a, b, c = 0; void prtFun (void); int main () { static int a = 1; /* line 1 */ prtFun(); a += 1; prtFun(); printf ( "\n %d %d " , a, b) ; } void prtFun (void) { static int a = 2; /* line 2 */ int b = 1; a += ++b; printf (" \n %d %d " , a, b); } |
chevron_right
filter_none
What output will be generated by the given code segment?
(A)
3 1 4 1 4 2
(B)
4 2 6 1 6 1
(C)
4 2 6 2 2 0
(D)
3 1 5 2 5 2
Answer: (C)
Explanation: See https://www.geeksforgeeks.org/c-language-set-9/
Quiz of this Question
Recommended Posts:
- GATE | GATE CS 2012 | Question 65
- GATE | GATE CS 2012 | Question 40
- GATE | GATE CS 2012 | Question 41
- GATE | GATE CS 2012 | Question 42
- GATE | GATE CS 2012 | Question 65
- GATE | GATE CS 2012 | Question 45
- GATE | GATE CS 2012 | Question 46
- GATE | GATE CS 2012 | Question 65
- GATE | GATE CS 2012 | Question 49
- GATE | GATE CS 2012 | Question 39
- GATE | GATE CS 2012 | Question 5
- GATE | GATE CS 2012 | Question 4
- GATE | GATE CS 2012 | Question 3
- GATE | GATE CS 2012 | Question 2
- GATE | GATE CS 2012 | Question 1



