Hello Guys/Gals,
I went to a 4 day C programming course in which I learned using windows. Now I'm using Xcode on my own MAC. I'm trying to practice some of the things I learned but having some small issues with Xcode. I wrote this C program to prompt the user to input 3 integer values and print these values in forward and reversed order, this is my code: Can anyone see where I went wrong?
include
include
int main()
{
int val1;
int val2;
int val3;
printf("Please select three numbers.");
scanf(" %d %d %d" ,&val1 ,&val2 ,&val3);
printf(" Your numbers forward are:\n");
printf("%d", &val1);printf("\n");
printf("%d", &val2);printf("\n");
printf("%d", &val3);printf("\n");
printf("Your numbers in reverse are:\n");
printf("%d" ,&val3);printf("\n");
printf("%d" ,&val2);printf("\n");
printf("%d" ,&val1);printf("\n");
return 0;
}
______________________________________________________________________________________________
This was my output after entering 1,2,3 as my numbers:
Please select three numbers.
1
2
3
Your numbers forward are:
1606416312
1606416308
1606416304
Your numbers in reverse are:
1606416304
1606416308
1606416312
1 Answer(s)