Friday, September 11, 2009

What is the shortest Cprogram you can write?



main()
{
}

There is no need to use #include, as there is no input or output so we don't need the iostream library
There's no need to specify a return value for main(). However, although C and C++ implicitly assume an integer return value for main() you should normally indicate the return type explicitly, with int main()
You do not need put any code inside main() You can specify return 0; to indicate to the operating system that everything is working OK, but it is not essential to put this in explicitly.

No comments:

Post a Comment