I came across a question where #define
was used to replace int
in the program as follows
#define type int
int main()
{
type *a,b;
}
Is this valid? Although it gave me error while I tried to print size of variable b saying b is undeclared. I want to know the specific reason behind this. Please let me know.
Some users told me that I have hidden some part of my code. I had not given the printf
statement in my above code snippet. Below is the code with printf
and the one which gives error
#define type int;
int main()
{
type* a, b;
printf("%d",sizeof(b));
}