C
Chad
In the following code snippet, I declare the variable val as float in
the calc.h header file, and define it
as int in test.c. The question is, when I compile this with full
warnings, I get no errors about the difference between float and int.
What did I miss here?
-------------calc.h---------------------------------
#ifndef CALC_H
#define CALC_H
extern float val;
#endif
----------------------------------------------------
---------------test.c----------------------------------
include <stdio.h>
#include "calc.h"
int main(void){
int val=100;
printf("The value is: %d\n", val);
return 0;
}
the calc.h header file, and define it
as int in test.c. The question is, when I compile this with full
warnings, I get no errors about the difference between float and int.
What did I miss here?
-------------calc.h---------------------------------
#ifndef CALC_H
#define CALC_H
extern float val;
#endif
----------------------------------------------------
---------------test.c----------------------------------
include <stdio.h>
#include "calc.h"
int main(void){
int val=100;
printf("The value is: %d\n", val);
return 0;
}