5. Difference between int and void return type with main                function

Code : 


#include<stdio.h>
#include<conio.h>
/*Difference between int return type
 and void return type with main function*/
void main()
{
  printf("hello world");
  getch();
}

Void return type have no return value.So this main function gives output without return any value.

Next let's see int main() function...

int main()
{
  printf("hello world");
  getch();
  return 0;
}

Int return integer value so we return any integer value in main function.

Output of both function : hello world

0 comments: