fabianmoronzirfas
5/11/2012 - 4:02 PM

a mini example c program

a mini example c program

// include the io lib
#include<stdio.h>
// the compare function takes integer as arguments 
int compare(int a, int b){
    if(a>b){return a;}else{return b;}
}
// the main function
int main(void){
   char name[11] = "Hello World"; // our string
   int a = 23,b = 5; // the values to compare
// now print all that stuff
// with %s you insert string arguments
// with %d digits 
   printf("The Object named: %s\nCompared: %d with %d.\n%d is bigger!",name,a,b,compare(a,b));
return 0;// everything went fine return 0
}