C Programming language

Identifiers in C
Previous Home Next

Identifiers are names which are given to elements of a program such as variables , arrays & functions. Basically identifiers are the group of alphabets or digits.

Rules for making identifier name

  1. the first character of an identifiers must be analphabet or an underscore.
  2. all characters must be letters or digits.
  3. There is no special characters are allowed except the underscore"_".
  4. There is no two underscores are allowed.
  5. don't use keywords as identifiers.

C Keywords:

  1. Keywords are the words whose meanings are already exist in the compiler.
  2. Keywords can not be use as variable names.
  3. Keywords are also called “Reserved words”.
  4. There are only 32 keywords available in C.

“auto, double, int, struct, break, else, long, switch,
 case, enum, register, typedef, char, extern, return, union,
 const, float, short, unsigned, continue, for, signed, void,
 default, goto, sizeof, volatile, do, if, static, while”

Definitions v/s Declaration in C

A declaration is when you declare a new variable of some specific type.

A definition is when you define a new name for some particular value or type.


* A function is only defined if its body is given
* so this is a declaration but not a definition
int func_dec(void);
* Because this function has a body, it is also
* a definition.
* Any variables declared inside will be definitions,
* unless the keyword 'extern' is used.
* Don't use 'extern' until you understand it!
int def_func(void){
     float f_var;            /* a definition */
     int counter;            /* another definition */
     int rand_num(void);     /* declare (but not define) another function */

Previous Home Next