Explain void functions with example

Explain void functions with example

The void function provide a way of emulating PASCAL type procedures.
If you do not want to return a value you must use the return type void and miss out the return statement:

  void squares()
                { int loop;

                         for (loop=1;loop<10;loop++);
                                 printf("%d\n",loop*loop);
                }

         main()

                {          squares();
                }
NOTE: We must have () even for no parameters unlike some languages.

Labels: