Help: Really strange output for simple calculation.
Hey everyone,
I have been reading up on the C language for a couple days and am trying to just play around with it a little bit and get the feel for using functions and whatnot. Well I tried to create a simple program that greets you and then asks you to enter two numbers (which another function in the program would be called on to multiply it and then output it. However, when i build and run the program, it outputs "-1115707584" for 2*2.
If someone could point out maybe what I'm doing wrong that would be super helpful.
Thanks,
gpix13
Code:
#include <stdio.h>
int multiply();
int pause();
int main () {
int x;
int y;
printf("Hello there!\n");
pause();
printf("Please enter a number:");
scanf("%i", &x);
printf("Please enter a second number:");
scanf("%i", &y);
multiply();
}
int multiply (int x, int y) {
int a = x * y;
printf("The product of your numbers is: %i", a);
return 0;
}
int pause() {
int move_on;
printf("Press 'Enter' to continue");
move_on=getchar();
return(0);
}