void Function

To indicate that the function does not return a value, declare it with a return type of void.Also to declare that there is no arguments with function just write void in place of it.

Syntax :

----void function-name( void ){ body}------   

A simple function is,

void print_message( void ) { printf("This is a module called print_message.n"); }

Note the function name is print_message. No arguments are accepted by the function, this is indicated by the keyword void in the accepted parameter section of the function declaration. The return_data_type is void, thus data is not returned by the function.

Example :

 void squares() {

int loop;  for (loop=1;loop<10;loop++); printf("%dn",loop*loop); }   main()   { squares();

}

Post Comment
Login to post comments