Programming
April 14, 2024
Programming
April 14, 2024
Programming
April 14, 2024
Programming
April 14, 2024

Programming

Question 18

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);
}

What output will be generated by the given code segment?

A
B
C
D
Question 18 Explanation: 

Hence
4 2
6 2
2 0
Correct Answer: C
Question 18 Explanation: 

Hence
4 2
6 2
2 0
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!