Example 1 : Function returning void data type

Program : Function returning void data type

#include<stdio.h>
void message();
int main()
{
message();
return(0);
}
void message()
{
   printf("Hello");
}

Explanation :


Prototype Declaration :

void message();

Void Data Type -
[arrowlist]

  • void means empty.
  • void data type means function does not return anything.
  • So we dont have to assign function call to any variable.
[/arrowlist] we don’t need to do -

num = message();

instead of this simply call function like this -

message();