Simplest C program
Preferred
#include <stdio.h>
int main(void)
{
return (0);
}
Accepted
but not standard
#include <stdio.h>
void main(void)
{
}
Simple program with a function call and a procedure (void function) call that
actually do something. The whole program is in one file.
/** Program header goes here **/
#include <stdio.h>
int value_returning_function(int);
void procedure(int, int);
int main(void)
{
int answer;
answer = value_returning_function(2);
procedure(2, answer);
return (0);
}
/** function header should be here **/
int value_returning_function(int val)
{
return (val * 2);
}
/** function header should be here **/
void procedure(int val1, int val2)
{
printf("\nValue 1 = %d and Value 2 = %d\n", val1, val2);
return; /* The return is optional - used for completeness */
}