I want to change the value of a macro during the run of the program, for that I've wrote this example :
#include <stdio.h>
#define MAX (65535 *0.5)
int main ( ){
float amp = 0.0;
float temp = 0.0 ;
temp = MAX ;
char c;
while (1){
printf(" MAX value %.2d.%.3d \n ", (short)temp,(short)(temp*1000));
scanf("%c",&c);
if( c =='x') {
#undef MAX
#define MAX (65535 +amp);
amp+= 0.1;
temp = MAX;
}
}
return 0 ; }
I've got two problems :
1. the printf doessn't show the values as hoped, for instand 19.211, it always
-32768.-32768
2. I don't see any change of the value of the macro.
any idea what I'm doing wrong here ?