1
1230987za
Hi,
I have the following 2 C files:
f.c:
#include <stdio.h>
void banana_peel(char c, short s, float f){
printf("char c = %c short s = %d float f = %f \n", c, s, f);
}
1.c:
int main(){
short ss = 7;
char cc = 65;
float ff = 10.0;
banana_peel(cc, ss, ff);
return 0;
}
I use gcc to compile them on Linux, and I see the result is :
char c = A short s = 7 float f = 0.000000
I am wondering why the value of f is changed?
When banana_peel is called in main(), ff is converted to double, but
it is still 10.0 right, then why argument f in function banana_peel
gets chopped off?
I have the following 2 C files:
f.c:
#include <stdio.h>
void banana_peel(char c, short s, float f){
printf("char c = %c short s = %d float f = %f \n", c, s, f);
}
1.c:
int main(){
short ss = 7;
char cc = 65;
float ff = 10.0;
banana_peel(cc, ss, ff);
return 0;
}
I use gcc to compile them on Linux, and I see the result is :
char c = A short s = 7 float f = 0.000000
I am wondering why the value of f is changed?
When banana_peel is called in main(), ff is converted to double, but
it is still 10.0 right, then why argument f in function banana_peel
gets chopped off?