Promble solved! Thanks to salem!
I wrote the following code to test the order in which function arguments are put onto the stack, and I got wired result:
Code:
void print_char(char c1, char c2)
{
printf("%p %p\n", &c1, &c2);
}
void print_float(float f1, float f2)
{
printf("%p %p\n", &f1, &f2);
}
int main(int argc, char **argv)
{
print_char('c', 'd');
print_float(1.2, 2.3);
return 0;
}
the result is:
0xbfcafef4 0xbfcafef0
0xbfcaff00 0xbfcaff04
which means for function print_char, the first argument is put onto the stack first, while for function print_float, the second argument is put first, why??
The code is run on 32-bit linux.