Identifiers in c – What is identifier in C

Interview Questions

  • What is identifier in C.
  • What is keyword in C.
  • What is the difference between constant and variable in C.

What is identifier in C

Identifiers in c: In C Programming language, the name of variables, functions, labels and user-defined entities are called Identifiers. Each element of a C program are given an identifier. A C identifier can be of any length, there is no limit on the length of the identifiers. An identifier cannot be same as any C keyword.
For Example

int totalAmount;
int getCompoundInterest(int amount, int rate, int time);

Interest is an identifier for a variable of integer data type.
getCompoundInterest is an identifier for a function and amount, rate and time are identifiers for function arguments.

What is keyword in C

C keywords are the reserved words which are pre-defined in C language. We cannot use keywords as an identifier for variable or function. Each keyword has a pre-defined meaning for C compiler. All C keywords are in lower case letters.
Some example of C keywords : break, case, continue, switch, for etc.

What is the difference between Constant and Variable in C.

Constants in C refer to fixed values that program cannot change during the time of execution whereas a variable in C is the name given to a memory location, where a program can store data. Variables can be initialized at the time of declaration and can be changes later whereas a constants cannot change.