When one declares
int my_number = 300;
Compiler allocates enough memory to store exactly 1 integer and writes bit representation of 300 in that space.
When one instead
#define MY_NUMBER 300
Whenever MY_NUMBER is mentioned, value is simply replaced with 300.
I understand that symbolic constants are not variables and wonder what happens from the stand point of memory allocation? In event a symbolic constant is used, how much memory is used to keep track of it?
Zero. The
#define-d constant is not a real constant: it does not have a type, and it does not occupy data memory. Its occurrences in your program are replaced with the literal300, that’s all. The constant value does occupy program memory in the binary code of your program, but it’s not the kind of memory to which you could take a pointer without getting into the undefined behavior territory.