CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

#include <stdio.h>
int fun( )
{
static int num = 16;
return num - -;
}
int main ( )
{
for (fun( ); fun( ); fun ( ))
printf("%d", fun( ));
return 0;
}


A
1310741
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
Infinite loop
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
1411852
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
1512852
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C 1411852
Since num is static in fun( ), the old value of num is preserved for subsequent function calls. Also, since the statement return num-- is postfix, it returns the old value of num and updates the value for next function call.

flag
Suggest Corrections
thumbs-up
3
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Integration as Anti-Derivative
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon