P
Paminu
I am trying to refresh my C skills and have therefore writtin this little
program:
#include <stdio.h>
int sum (int a, int b)
{
printf(a+b);
return a+b;
}
int main()
{
sum(1,2);
}
But when I compile I get :
test.c: In function `sum':
test.c:5: warning: passing arg 1 of `printf' makes pointer from integer
without a cast
me@ubuntu:~/opgaver$ ./test
Segmentation fault
What am I missing?
program:
#include <stdio.h>
int sum (int a, int b)
{
printf(a+b);
return a+b;
}
int main()
{
sum(1,2);
}
But when I compile I get :
test.c: In function `sum':
test.c:5: warning: passing arg 1 of `printf' makes pointer from integer
without a cast
me@ubuntu:~/opgaver$ ./test
Segmentation fault
What am I missing?