Why doesn't the following work when using double (it works using int)
test.c
#include "myFcn.h"
#include <stdio.h>
int main () {
printf("L1: %f \n", myGet_L1());
mySet_L1(10.0);
printf("L1: %f \n", myGet_L1());
return 0;
}
myFcn.c
#include "myFcn.h"
double L1 = 0.0;
double get(double *v) {
return *v;
}
void set(double *variable, double value) {
*variable = value;
}
myFcn.h
#ifndef __MYFCN_H__
#define __MYFCN_H__
extern double L1;
#define myGet_L1() get(&L1)
#define mySet_L1(value) set(&L1, (value))
#endif
I don't see why this is working when using int but not doubles?