0

What's difference between idenfiers and variables in C?

Please answer with examples.

14th Aug 2018, 5:48 PM
Ankit Jaiswal
Ankit Jaiswal - avatar
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.
14th Aug 2018, 7:49 PM
Vlad Serbu
Vlad Serbu - avatar
+ 1
a variable is an identifier, but an identifier can be something else, like a function or a macro for example
17th Aug 2018, 5:57 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar