Home » C Programming » Basics of C Programming

Basics of C Programming

Tokens

In a C language, token is either a keyword, a symbol ,an identifier, a constant or a string literal.

A C program consists of various tokens for example, the following C program consists of five tokens −

The individual tokens are −

Comments

Comments are the text in C program and they are ignored by the compiler during compilation and execution.

They start with /* and terminate with the characters */ as shown below −

Anything written within Comment will never execute. You can’t write comments within comments.

Identifiers

In a C language, identifier is a name given to any variable, function, or any other user-defined item.

C language identifier starts with a letter A to Z, a to z, digits (0 to 9) or an underscore ‘_’ followed by zero.

C does not allow punctuation characters such as @, $, and % within identifiers. Here are some examples of acceptable identifiers −

Keywords

In a C language keywords are the reserved words whose meaning already explained in a compiler.

These reserved words can’t be used as a variables or identifier names. There are 32 Keywords in 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
default if static while
do int struct double
Please follow and like us:
error