Macro definition error in C?

后端 未结 3 1214
清酒与你
清酒与你 2021-01-20 18:40
#define SOUND_SPEED 0.034;    
int rtt; //round trip time in microsecond
double distance;
distance = (double)(rtt*SOUND_SPEED)/2;

It complains erro

3条回答
  •  无人及你
    2021-01-20 19:44

    Drop the semicolon:

    #define SOUND_SPEED 0.034; 
                             ^
    

    If you keep it the generated code will look like this:

    distance = (double)(rtt*SOUND_SPEED;)/2;
                                       ^
    

提交回复
热议问题