some-usable-scripts/function.c

26 lines
432 B
C
Raw Normal View History

2011-02-07 23:41:38 +01:00
// This is an example of function
2011-02-03 13:47:29 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int multiple(int, int);
int main( int argc, char **argv)
{
if(argc < 3)
{ perror("Usage : ./truc.out nombre nombre\n"); return 1; }
int var1 = atoi(argv[1]);
int var2 = atoi(argv[2]);
int truc = multiple(var1,var2);
printf("Mon multiple : %d %s \n", truc, "Salut !");
return 0;
}
int multiple(int a, int b)
{
return a * b;
}