C programming language was developed by Dennis Ritchie at Bell Laboratory in 1972 for the purpose of using in the UNIX OPERATING SYSTEM. Through C language, we can develop portable application software. C is a good platform for developing the system software and embedded system.
C is an easy and interesting programming language. Before start learning C programming, we should know three basic principles -
1- Variables
2- Datatypes and
3- Operators
1- Variable:
Variables are the memory location that are used to store information and it is represented by character or character set. for example x,y,i,z,temp,switched,count etc...
Rules for Variable Declaration
Following are the rules for the variable declaration:
- Variables contain minimum one alphabet.For example x,y,z etc are right declarations and 1,2,3,# etc are wrong declarations.
- The first character of the variable must be an alphabet or underscore. For example- x1,temp1,student2 etc are the right declarations and 1x, 1temp,2stu etc are wrong declarations.
- Special characters are not allowed in variable declaration except underscore ('_'). For example a@,temp!,sn$no etc are the wrong declarations and student_name, roll_no etc are the right declarations.
- Spaces are not allowed in variable declaration. For example 'student name' is wrong declaration because there is a space in between the student and name.
- Key words are not allowed in variable declaration. For example void auto, break, case, char, const, continue, default etc are the keywords, so, we can not use these keywords as a variable name.
Keywords are the reserved words in C language. There are 32 keywords available in C programming languages and the list containing all the keywords is given below:
1- auto, 2- break, 3- case, 4- char, 5- const, 6- continue, 7- default, 8- do, 9- double, 10- else, 11- enum, 12- extern, 13- float, 14- for, 15- goto, 16- if, 17- int, 18- long, 19 - register, 20- return, 21 short, 22- signed, 23- sizeof, 24- static, 25- struct, 26- switch, 27- typedef, 28- union, 29 -unsigned, 30- void, 31- volatile, 32- while.
Datatype:
The type of data is known as datatype.
Data: Data is a raw facts. We can understand the data by following diagram:
Generally there are two type of data Constant and Variable. Again constant and variable are categorized into three parts-
Datatype:
The type of data is known as datatype.
Data: Data is a raw facts. We can understand the data by following diagram:
- Numeric
- Character
- String
The Numeric data is again categorized into two parts-
- Integer
- Real
And at last Integer & Real is again divided into three parts-
- Decimal
- Octal
- Hexadecimal
Now, we can understand the datatype. DATATYPE is a type of data which can be NUMERIC (INTEGER,REAL), CHARACTER OR String Type. Here we begin to understand each and every type of data.
Operators:
Operators are some special symbols which operate upon arithmetic and logical operations. For example '+', '-', '>', '*' etc. The main operators used in C programming language are given below:
Operators:
Operators are some special symbols which operate upon arithmetic and logical operations. For example '+', '-', '>', '*' etc. The main operators used in C programming language are given below:
- Arithmetic Operator
- Relational Operator
- Logical Operators
- Increment/Decrement Operator
- Assignment Operator
- Bitwise Operator
- Ternary Operator
- Special Operator