CJCoding With Joseph
15per day
← Back to Question List
C Code Walkthrough #8

Global vs Local Variable

mediumFunctions

📄 Code

Read carefully — what does this print?
1#include <stdio.h>
2 
3int x = 10;
4 
5void change() {
6 int x = 20;
7 printf("%d\n", x);
8}
9 
10int main() {
11 printf("%d\n", x);
12 change();
13 printf("%d\n", x);
14 return 0;
15}

🎯 Your Answer