Function without returning any value. - C Function

C examples for Function:Function Definition

Description

Function without returning any value.

Demo Code

#include <stdio.h> 

//function definition 
int compareTwoNumbers(int num1, int num2){ 
  if (num1 < num2) {
      printf("\n%d is less than %d\n", num1, num2); 
      return 1;//from ww w  . ja  va  2 s  .  c om
  }else if (num1 == num2) {
     printf("\n%d is equal to %d\n", num1, num2); 
     return 0;
  }else {
     printf("\n%d is greater than %d\n", num1, num2); 
     return -1;
  }
} 

int main() 
{ 
   printf("start."); 
   compareTwoNumbers(2, 3) ;
}

Result


Related Tutorials