I am having a hard time understanding how aurgument work. I understand how one aurgement in a function work. But, when two or more aurgement in a function i get confused. I written 2 simply program to try to understand. The first program is with a function with one aurgement. This is clear and straight foward. The second program contain two aurgement in a function. This i can't understand. Why do i really need to have two aurgument when i can get my value with one aurgument? Can anyone explain how aurgement work?
Code:
#include <stdio.h>
#include <stdlib.h>
int square(int y);
int main(void)
{
int x;
for(x=1;x<=3;x++){
printf("%d",square(x));
printf("\n");
}
system("PAUSE");
return 0;
}
int square(int y)
{
return y*y;
}
This is my second program with two aurgument. I try to make a program that was simply so i can understand.But i don't get how two aurguments works.
Code:
#include <stdio.h>
#include <stdlib.h>
int square(int y, int z);
int main(void)
{
int a=1;
int b=2;
printf("%d",square(x)+z);
printf("\n");
}
system("PAUSE");
return 0;
}
int square(int y, int z)
{
return y*y, z+z;
}