A global variable is used throughout the program. It can be used by different code blocks. It is always declared outside the function. It is generally used when many functions have to use the same variables. For Example:
count = 25;
temp = count;
printf(“count is %d”, count); }
for(count=1; count<10; count++)
Here count is the global variable which has been used throughout the program.