C Language
Reserved Keywords
In C, there are a set of reserved keywords that have predefined meanings and cannot be used as identifiers (such as variable names, function names, etc.) because they are part of the language's syntax. These keywords are reserved for specific purposes in the language.
- auto
- break
- case
- char
- const
- continue
- default
- do
- double
- else
- enum
- extern
- float
- for
- goto
- if
- int
- long
- register
- return
- short
- signed
- sizeof
- static
- struct
- switch
- typedef
- union
- unsigned
- void
- volatile
- while
auto | break | case | char | const |
continue | default | do | double | else |
enum | extern | float | for | goto |
if | int | long | register | return |
short | signed | sizeof | static | struct |
switch | typedef | union | unsigned | void |
volatile | while |
These keywords (Total 32 keywords) are an integral part of the C language and are used to define control structures, data types, and other elements in your C programs. When writing C code, you should avoid using these keywords as variable or function names to prevent conflicts and ensure your code is syntactically correct.
Escape Sequences
Escape sequences in C are special sequences of characters that are interpreted by the compiler or runtime environment to perform certain actions, such as inserting special characters or controlling the behavior of output. Escape sequences always begin with a backslash '\'.
Here are some common escape sequences in C:
Character Constant | Meaning |
---|---|
\n | Move to new line |
\r | Move to new line |
\t | Horizontal tab |
\v | Vertical tab |
\a | Alert (Bell) |
\\ | Print back slash |
\? | Print qustion mark |
\' | print singel quote |
\" | print double quote |
\0 | Null character |
\? | Question Mark |
\nnn | Octal value |
\xhh | Hexadecimal Representation |
Usage of escape sequences in C:
#include <stdio.h> int main() { printf("Hello\tworld!\n"); printf("This is a backslash: \\ \n"); printf("She said, \"Hello!\"\n"); printf("This is a bell: \a\n"); printf("This is a hexadecimal representation: \x41\n"); return 0; }
Hello world! This is a backslash: \ She said, "Hello!" This is a bell: This is a hexadecimal representation: A
Note: Escape sequences are especially useful when you need to include special characters in strings or control the formatting of output.
What's Next?
We've now entered the finance section on this platform, where you can enhance your financial literacy.