I've just started the C programming tutorial and I'm trying to modify the code to practise what I've learnt. This is what I have:
Code:
#include <stdio.h>
int main()
{
int num1, num2, ans1;
printf( "Insert a number pl0x: " );
scanf("%d", &num1);
printf("Insert another number pl0x: ", &num2);
scanf("%d", &num2);
ans1 = num1 + num2;
printf("The two numers entered added together are: %d", &ans1);
getchar();
return 0;
}
No matter what number I enter, I get the same (wrong response):
Code:
Insert a number pl0x: 3
Insert another number pl0x: 3
The two numers entered added together are: 2293580
I think it has something to do with the last printf statement. Can anyone point me into the right direction?