After execution, result was very strange:
#include <stdio.h>
int main(){
int a,b;
printf("enter two numbers :");
scanf("%d%d",&a,&b);
if(a>b){
printf("maximum number is %d",&a);
}
else{
printf("maximum number is %d",&b);
}
return 0;
}
After enter two numbers in console result was:
maximum number is 2686696
2686696 very strange for me if I enter two numbers such as 5, 3 must shows me 5 but shows 2686696 !!!
Can anyone guide me?
Remove &
from printf
to print the value, now you're printing the address. Should be:
printf("maximum number is %d",a);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments