When i declare array in c before main method it gives, an error. Declaration is

char a[65000];
main()
{}
and another declaration in other file
char a[63000];
main()
{}

has no error what is the reason.

The variables are extern (global variables) the default value they take are zero. main() is any other function if you dont have anything in it,they dont do anything. So no errors are returned

Yes, the default value of global variables is 0, that's not an error message. And the compiler is warning you that you did not put any code within the body of function main. That's also not an error. What compiler and operating system are you using?

I don't know why it compiles without problems in one program and not in the other. Maybe there is a problem with one of the lines above the array declaration. Post the entire program that is causing the messages so that we can see what you did.

Edited 4 Years Ago by Ancient Dragon

i m using windows xp os and turbo c compiler.
actually char a[60000] does not give error but char a[65000] gives
abnormal program termination in output.

The problem is that you are using a very very old compiler that was intended for MS-DOS 6.X, not modern MS-Windows. Those old MS-DOS programs had very limited memory and stack space, no data objects could exceed 64K, and your array is too large. There is no solution to the problem other than using a modern C or C++ compiler, such as Code::Blocks with MinGW compiler and VC++ 2010 Express (both are free). I realize that colleges in India are 30 years behind the curve and still teach programming with Turbo C, so if that's where you are at then you can't change compilers. Its a pitty that India colleges and universities are so terrible especially when they could easily get modern compilers for free.

Edited 4 Years Ago by Ancient Dragon

ancient dragon is absolutely right indian colleges does not update anything teaching the same

This article has been dead for over six months. Start a new discussion instead.