why answer comes zero ?

hello , this code works fine i want to know why answer comes zero ? . plz dont mind .h in header files , it runs in turbo c++ and borland 4.5 .
1
2
3
4
5
6
7
8
9
#‎include‬<iostream.h>
#include<conio.h>
int a; // glblly dec.
void main()
{
clrscr(); 
cout<<a;
getch();
}
Global (or, more generally, static) objects of type int are always initialized to zero. What did you expect?
Last edited on
Turbo C++ and Borland are excessively outdated compilers. Avoid using them at all costs unless some outdated professor with tenure threatens your college career.
thanks for the answer . i have to use them cuz of school
Topic archived. No new replies allowed.