Programmer Coding

What is Identifiers in C?

C identifiers are variables, functions, arrays, structs, unions, tags, etc. in C programs. represents names. The code consists of uppercase letters, lowercase letters, underscores, numbers, etc. can occur, but the first letter must be a letter or number. If the identifier is not used in external links, it is called Internal identifier. If the ID is entered in an external link, it is called an external identifier.

A symbol is a symbol that starts with a character or a number and contains variables, functions, arrays, structures, unions, labels, etc. We can say that it is a collection of alphabetic characters used to represent various programs such as There are 52 letters (capital letters and numbers), an underscore, and 10 numbers (0-9) representing symbols. There are a total of 63 alphanumeric characters representing character

                C identifier

          construction rules

 

  • The first character of the identifier must be a letter or number, followed by symbols, numbers, or underscores. It should not start with the number
  • Since uppercase letters and lowercase letters differ in character, we can say that the number of characters is important.
  • A comma or space cannot be specified in a character.
  • The keyword cannot be represented as a character.
  • The length of the character must not exceed 31 characters.
  • Signs should be written to be useful, short and easy to read.

 

  • Variable names

int age;

float salary;

char letter;

  • Function names

void printMessage() {

printf(“programmer__coding\n”);

}

  • Constant names

const int MAX_SIZE = 100;

const float PI = 3.14159;

  • Structure names

struct Person {

char name[50];

int age;

};

  • Array names

int numbers[10];

char name[50];

  • Pointer names

int *ptr;

char *strPtr;

  • Enumeration names

enum Weekdays {

MONDAY,

TUESDAY,

WEDNESDAY,

THURSDAY,

FRIDAY

};

Types of identifiers

  • Internal identifier
  • External identifier

Internal Identifier

  • If the identifier is not used in an external link, it is called Internal identifier. Internal identifiers can be local variables.

External Identifier

  • If the ID is entered in an external link, it is called an external identifier. External identifiers can be function names or global variables.

Differences between Keyword and Identifier

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top