These are two different things. #include is a preprocessor directive that is processed at compile time . swicth is the C keyword that runs at run time .
So, you can use conditional preprocessors to choose which file to include:
#ifdef MATRIX #include "matrix.h" #else #include "grid.h" #endif
Or you can also include both, because it usually doesn't matter if you include a useless header file.
#include "matrix.h" #include "grid.h" switch(opt) { case 0: break; case 1: break; }
source share