Hello, Viewer's in the previous post we learn about the translator (Compiler, Interpreter). Now in this post, we learn about the C programming language. So let's start
History of C language
C language was developed by the "Dennis Ritchie" in 1972 at BT & T laboratories. (also check the images for more history of C )
Application of C
Some Important terms
There are many important terms/topic in the programming world. we study all terms one by one.
Identifiers
Identifier is a fundamental building block of the program and it is a combination of permissible character.
Rules for writing an Identifier
There is some identifier in C which have predefined meaning these identifiers are called keywords.
Examples: int, char, float, sizeof, void etc.
Tokens
Tokens is a group of characters which represent keywords, operators, and identifiers.
Thanks 4 reading our blog! hope you like it. In the next post we'll discuss more basic fundamentals related to programming world.
History of C language
C language was developed by the "Dennis Ritchie" in 1972 at BT & T laboratories. (also check the images for more history of C )
- It is a combination of high-level programming language.
- It is used in almost all software.
- It is fast, reliable and highly portable and can run under a various operating system.
Application of C
- C language finds in business, education, scientific etc field. It provides various type operation and statements to solve computationally problem.
- C is used in system software such as operating system, compiler etc and application software such as verification software, test code etc.
Some Important terms
There are many important terms/topic in the programming world. we study all terms one by one.
Identifiers
Identifier is a fundamental building block of the program and it is a combination of permissible character.
Rules for writing an Identifier
- Only alphabetic letters, digits and underscore are permitted in an identifier.
- An Identifier name can't start with a digit.
There is some identifier in C which have predefined meaning these identifiers are called keywords.
Examples: int, char, float, sizeof, void etc.
Tokens
Tokens is a group of characters which represent keywords, operators, and identifiers.
Examples:
- Keywords
- Identifiers ( declare by the program )
- Operator ( +, -, <, >, =, etc. )
- Numeric ( 24, 24.35, 0.08 etc. )
- Characters
Constant are the fixed data value that do not change their values during the execution of a program. these are also called "Literals".
Variables
Variable is a name of the memory location where a program saved. we can change the value of a variable during the execution of a program.
Rules for Naming a Variable
- The first character of a variable should always be the alphabet.
- Special character ( except- Underscore ) can't be part of a variable name.
- The Variable name can have a combination of Lowercase & Uppercase.
- The variable should not be a keyword.
There are various datatypes in C are follows:-
- Primitive Datatype
- Derived Datatype
- User Defined Datatype
It includes
- Characters or char ( a,b,v etc )
- Integer or int ( 21, 20, 98 )
- Floating ( 20.2, 23.26,0.08 )
- Fixed Point Number
C also supports three types of derived data
- Array
- Function
- Pointer
C support three type of user-defined datatype
- Structure
- Union
- Enumerated
Any Numbers which have no points.
Example: 50, 0, -44
Character
In which include single codes ( ' ' ) and only one symbol.
Example: 'a', 'b', 'l' etc.
Floating
Any Numbers which have points.
Example: 20.0, 52.3, 89.9 etc.
Array
- An array is a linear collection of similar elements. An array is also known as "Subscript Value".
- An array is a group of a variable.
- Array indices start at Zero in C and go to one less than the size of array.
variable_name[num_elements]
Example:
int A[100];
- It creates an array A with 100 integer elements.
- The size of array A can't be changed.
- The number between brackets must be a constant.
int A[5] = {0,1,2,3,4}; // Array can be initialize during declaration
Pointer
- A pointer is a variable that contains the address of another variable.
- Pointer always consumes 2 bytes in memory. ( for a 16-bit compiler )
data_type*variable_name
Example
int *p;
char*p;
where * is used to denote that "p" is pointer variable and not a normal variable.
- The value of a null pointer is zero.
- "&" symbol is used 2 get the address of a variable.
- "*" symbol is used 2 get the value of the variable.