C Preprocessor - Add Elements to Struct at Compile Time
Clash Royale CLAN TAG #URR8PPP C Preprocessor - Add Elements to Struct at Compile Time I am trying to think of a way to add elements to a struct at compile time, but by defining this in another file. For example: defA.h: typedef struct A { int element1; int element2; } A; otherfile.c: #include "defA.h" typedef struct B { int element1; } B; ADD_ELEMENT_TO(A, B, element3) Would result in: struct A { int element1; int element2; B element3; }; Can anyone think of a way to achieve this or something similar? I want to be able to control this by choosing to compile otherfile.c or not with the rest of the build. otherfile.c What problem are you trying to solve? – OldProgrammer 3 mins ago It is not unusual to want the contents of some structures to depend on conditional compilation, but...