General Discussions

main() – int or void?

Programmers generally use a

int main()

or a

void main()

Every function should return a type. Either a success status or a failure status. Even main is a function and should return a type.

It is not advisable to use void main(). It should always be int main().

A void main() means it returns no status after execution. With respect to programming, it is not a good practice!

Advertisements

Let me Know What you Think!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s