I've been trying to write a simple program using that minimum of knowledge that I have in C. I tried to write it intuitively, and I guess got it wrong. can anyone please check the code?
1 2 3 4 5 6 7 8 9 10 11 12
#include <stdio.h>
main()
{
int a, b, s;
s=a+b;
puts("The sum of:");
scanf("%d", &a);
puts("and");
scanf("%d", &b);
printf("is %d", &s);
}
After trying to compile the message is:
sum.c: In function ‘main’:
sum.c:11: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
Just note that this doesn't print any legit value, since you sum them up before they're given a value. The right spot to place s=a+b; shouldn't be too hard to find given the above hint.