printf is only printing "1537" rather than the value of the integer
I'm just now learning programming, so this might seem a tiresome question.
But when I try to print the value of an integer, it prints "1537" instead.
Here is the function, feel free to scrutinize.
void compare(void) {
int num1;
int num2;
int num3;
int num4;
int smallest;
printf("Please enter four integers:\n");
scanf("%d %d %d %d", &num1, &num2, &num3, &num4);
num1 = smallest;
if (num2 < smallest)
num2 = smallest;
if (num3 < smallest)
num3 = smallest;
if (num4 < smallest)
num4 = smallest;
printf("%d is the smallest\n", smallest);
}
No comments:
Post a Comment