En void funksjon er en funksjon som ikke skal returnere noe.
#include <iostream.h>
#include <math.h>
void main()
{
int tall = 3;
cout<<"Opphøyd er: "<<pow(tall,tall)<<endl;
}
Mens en annen funksjon gjerne returnere noe:
#include <iostream.h>
#include <math.h>
int main()
{
int tall = 3;
cout<<"Kvadratroten er: "<<sqrt(tall)<<endl;
cout<<"Log er: "<<log(tall)<<endl;
cout<<"Cos er: "<<cos(tall)<<endl;
cout<<"Opphøyd er: "<<pow(tall,tall)<<endl;
return 0;
//0 er i dette tilfelle true eller suksess
}