I have the following program
void swap(float * x, float * y)
{
float aux
aux = *x;
*x = *y;
*y = aux;
}
int main(void)
{
double a = 3.5, b = 5.6;
swap(&a, &b);
printf("%g %g\n", a, b);
return 0;
}
The program compiles, it obviously throws some warnings, but it runs, and the values of a, b
don't get swapped. I don't understand what is happening, I would've thought either this wouldn't have compiled, or it would work, but this is pretty different.
What is happening?