Как объявить глобальную переменную в C
You just need to declare a variable out of the function main in order to make it global.
Inquisitive Iguana
You just need to declare a variable out of the function main in order to make it global.
#include <stdio.h>
void display();
int n = 5; // global variable
int main()
{
++n;
display();
return 0;
}
void display()
{
++n;
printf("n = %d", n);
}