Introduction of C Programming
In computer science C is a programming language which is the mother language of all programming languages like C++, C# (C-Sharp), Java etc. This is developed to create Unix Operating System which is the world’s strongest OS. Dennis M.Ritchie developed this language in 1972 at the Bell Laboratories.
Why C is mother language of programming?
It is a good and attractive question and every programmer should know the answer. C language is easy to learn and use, structured, efficient, powerful in compare to COBOL and FORTRAN. Most of the languages are developed with the help of this language and the concepts are same. Every programmer or software developer first learns c language then other programming because it plays a key role and gives guidance. If you learned this language and command on it then you can also learn others very easily because most of the topic, or functions line variable, constant, operator, loop, array, function, structure etc are same.
Software needed for c programs?
To run C programs you have to install TC/Turboc Software in your system and open it.
You will get a blue screen, now write the code then compile and execute.
How to Compile C programs?
To compile c programs press ALT+f9
How to Run C programs?
Press CTRL+f9
Press CTRL+f9
A Simple program of C:
#include<stdio.h>
- Variable and Constant
- Data Type
- Operator
- Loop
- Array
- Function
- Input/Output
- Structure
Note: There are some other data types which are user defined but used in other programming languages which are object oriented r which has class concept. Array, class and interface are the examples of those data types. C language has not concept of class so you can't use these data types.
Operator are special symbols used in programs to perform certain operations like addition, multiplication, assign values, compare operands etc.
Examples:
Unary Operator :-
This operator is performed on only one operand such as a++, ++a etc.
Binary Operator:
This operator is performed on two operands such as a+b, a-b, a*b etc.
Ternary operator:- Ternary operator also perform operation on two operands but in short form such as (a>b)?a:b;
Apart from the given types and examples we can also study the operator in many forms such as arithmetic operator, assignment operator, relational operator and logical operator, etc.
Arithmetic Operator:-
Arithmetic operator are used to perform arithmetic operation (addition, substraction, multiplication, division, modulo) on two operands such as-
A+B, A-B, A*B, A/B, A%B
On the above given example there are five operators are used in arithmetic operator which are as well-
+ :- Used to add two operands
- :- Used to substract two operands
* :- Used to multiply two operands
/ :- Used to divide two operands
% :- Used to get the reminder
Assignment Operator:-
This operator is used to assign a value to the operator to use in the program. The symbol = (equals to) is used between two operands such as A=B; or A=5;
Relational Operator:-
As its name suggest it is used to define the relation between two operands or also to compare the operands to get the result that which is greater, smaller etc. Details with symbol are given below-
A>B; :- A is greater than B
A>B; :- A is smaller than B
A>=B; :- A is greater than or equal to B
A<=B; :- A is smaller or equal to B
A=B; :- A is equal to B
Note:- When we compare two operands then there may be three situations such as one operand may be greater or smaller or equal.
Logical Operator:-
Logical operator is used to apply logic on conditions of the programs to clearing that the given condition is true or false. It is also also helping in decision making of program.
There are three types of logical operator in every programming language which are given below-
AND &
OR ||
NOT !
- If both condition is true then AND operator works otherwise you will get an error.
- If any one of the conditions is true then the program will run
- If the given condition not matched to the condition then it will run.
No comments:
Post a Comment