0
What's difference between idenfiers and variables in C?
Please answer with examples.
2 Respostas
+ 3
An identifier is the "name" of a variable.
int d;
d is the identifier to a 16/32-bit section of memory that is to be interpreted as an integer.
int x = 5;
printf("%d\n", x); //prints 5
int *p = &x; //a pointer to the location of x.
*p = 7;
printf("%d\n", x); //prints 7
As you can see in the example above, you can change the memory that sits at the location of x without using the "x" identifier.
+ 1
a variable is an identifier, but an identifier can be something else, like a function or a macro for example