Keywords and Escape Characters in C

 

Keywords
​​

  • Keywords are the system defined identifiers.
  • All keywords have fixed meanings that do not change.
  • White spaces are not allowed in keywords.
  • The keyword may not be used as a user-defined identifier.
  • It is strongly recommended that keywords should be in lower case letters.
  • There are totally 32 keywords used in a C programming.

 



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


 

Escape Characters:

  • Escape Sequence Characters (Backslash Character Constants) in C:
  • C supports some special escape sequence characters that are used to do special tasks.
  • Some of the escape sequence characters are as follows:

Character     Constant Meaning
\n                   New line (Line break)
\b                   Backspace
\t                    Horizontal Tab
\f                    Form feed
\a                  Alert (alerts a bell)
\r                   Carriage Return
\v                  Vertical Tab
\?                  Question Mark
\’                  Single Quote
\”                  Double Quote
\\                  Backslash
\0                  Null

Example codes on escape sequences:
void main()
{
clrscr();
printf(“%d%d\b\b%d”,1,2,3);
getch();
}

void main()
{
char str[20]=”__java2python”;
clrscr();
printf(“%s\r%c”,str,’C’);
getch();
}

Share this