C Programming Language Basic concepts
Let us learn the basic fundamental concepts in the C programming language. We will learn the Keywords in C language, Syntax in C language, Character Set in C language, delimiters, and identifiers in C
If you wish to learn the C language from the very start, please start from here - C programming language.
Instructions in C, Keywords and Symbols in C programming language
A program is a set of instructions. Instructions are formed using certain words and symbols. C supports data used to write words and symbols such as numbers, characters, strings, and so on. Usually, words and symbols are written based on the syntax or the grammar rules of the language. In general, programmers need to follow the syntax rules of the language to write a program. Let us look at the basic syntax of the C programming language.
C Character Set
C Character Set is used to form words, numbers, and expressions. C Character Set is classified into different categories:
- Letters in C programming language
C uses the English Alphabet in both forms - Capital letter A to Z and Small letter a to z.
- Digits
C includes all decimal digits from 0 to 9.
- White spaces in C
C allows white spaces to be present in the statement. Spaces are used to separate words and statements and for better readability. Useful white spaces included in C are blank space, horizontal tab, vertical tab, and newline.
- Special Characters in C programming
C supports some kind of special characters or symbols. Following are the list of special characters:
Symbol Meaning Symbol Meaning , comma . period or dot ; semicolon : colon ' apostrophe „ quotation mark ! exclamation mark | vertical bar / slash \ back slash ~ tilde _ underscore $ dollar ? question mark & ampersand ^ caret * asterisk − minus + plus < less than > greater than ( ) parenthesis [ ] bracket { } brace % percent # number sign or Hash @ at the rate = equals to
Delimiters in C programming
C uses special kind of symbols:
Delimiters | Use |
---|---|
: colon | Useful for label |
; semicolon | Terminates statement |
( ) parenthesis | Used in function and expression |
[ ] square bracket | Used for array declaration |
{ } curly brace | Scope of the statement |
# hash | Preprocessor directive |
, comma | Variable separator |
Keywords
C has some reserved words that are used by the compiler which have fixed meaning. We cannot use these keywords as a variable name or constant or function name. For using these keywords, we do not include any header file in our program. Following are the list of keywords; you should notice that all these keywords use lower case letter.
auto | do | int | struct |
break | else | long | switch |
case | extern | return | union |
char | enum | register | unsigned |
const | float | shot | typedef |
continue | for | signed | void |
double | goto | sizeof | volatile |
defualt | if | static | while |
Identifiers in C programming
In C, identifiers are used to refer to several things; variable name, function name, and arrays. Identifiers in C are the user-defined names that consist of a sequence of letters, digits, and ' _ ' underscore.
The rules for defining an identifier:
- The first character must be an alphabet.
- The variable names may begin with '_' but this may be used only for library implementation.
- An identifier may contain underscore and digits.
- Reserved keywords may not be used as an identifier.
- Use lower case letter for variable name and upper case letter for symbolic constant.
- C is a case-sensitive programming language, so the identifier 'Woman' is different from the identifier 'woman'.
Examples
Fact, myfunction, a, text, Text, _abc, sum, ADD, multi