Learn Flutter Framework by Google to Build Beautiful Apps. Learn App Development on FlutterCampus

Keyword and Identifier | C Programming

C Programming

Keyword and Identifier | C Programming

Keyword and Identifier

Keywords
Keywords are predefined, reserved words used in programming that have special meaning to the compiler. Keywords are part of the syntax and they cannot  be used as an identifier. Eg:

int happy;
Here, int is a keyword that includes happy is a variable of type int (integer).
As C is a case sensitive language, all keywords must be written in lowercase. Here is a list of all keywords allowed in ANSI C.

auto

else

long

switch

break

enum

register

typedef

case

extern

return

union

char

float

short

unsigned

const

for

signed

void

continue

goto

sizeof

volatile

defult

if

satic

while

do

int

struct

­_Packed

double

 

 

 

Rules for naming keywords

  • Keywords should not be used either as variables or constant.
  • Instructions in C language are formed using syntax and keywords.
  • Keywords cannot be used as a variable name.
  • Keywords are specifically used by the compiler for its own purpose and they serve as building blocks of a C program.
Identifiers
C identifier is a name used to identify a variable, function, or any other userdefined item. An identifier starts with a letter A to Z, a to z, or an underscore ‘_’ followed by zero or more letters, underscores, and digits (0 to 9). C does not allow punctuation characters such as @, $, and % within identifiers. C is a case-sensitive programming language. Thus, Manpower and manpower are two different identifiers in C. Here are some examples of acceptable identifiers:
mohdzaraabcmove-name, a123, myname50, _temp, j, a23b9, retVal

Rules for naming identifiers

  • A valid identifier can have letters(both uppercase and lowercase letters), digits, and underscores.
  • The first letter of an identifier should be either a letter or an underscore.
  • You cannot use keywords as identifers.
  • There is no rule on how long an identifies can be.

However, you may run into problems in some compilers if the identifier is longer than 31 characters. You can choose any name as an identifier if you follow the above rule, however, give meaningful names to identifiers that make sense.

You may also like to read:

Luna GPS - GPS Tracking system in Nepal
Learn Flutter, App Templates, Packages
Vitamin nepal
Join with us on social media to see our updates on your feed.