samedi 10 octobre 2020

Is it possible to define global variables in a function and use the variable in other function using preprocessor directives in C++?

I am trying to understand the preprocessor directives (like #if , #ifdef, #ifndef) and following is the code I have tried out.

Main_class.cpp Wrap.h file Output

Note: The member functions are further wrapped and used in python and hence the results show the python like calls but this does not affect any of the c++ process.

Question: 1. As per my understanding the global variables have a scope of whole file from the point it is declared. Then in this case, why is the defined value not accepted inside another function?

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire