Basic of C-Language, history, characterstics of C
ANDHRA UNIVERSITY, TELANGANA UNIVERSITY, NAGARJUNA UNIVERSITY, OSMANIA UNIVERSITY
ANDHRA UNIVERSITY, TELANGANA UNIVERSITY, NAGARJUNA UNIVERSITY, OSMANIA UNIVERSITY
C LANGUAGE
'C' is a structured based Programming Language developed by Dennis Ritchie in 1972.
HISTORY:
1960 ALGOL
1963 CPL
1967 BCPL
1970 B
1972 C
All the above Programming Languages has got some or others remarks for which programmers used to face some difficulties and to overcome all the remarks/ drawbacks C Language has been introduced at AT&T bell Laboratories.
Characteristics of 'C'
- Structured
- Simple
- Portability
- Easy of Understanding
- Flexible - take up any project solution
- Robust
- Strong and efficient
Data types are of two Categories
- Primary Data types:
- Integer int
- Float float variable_name;
- Character char variable_name;
- Double double variable_name;
- Void void function_name();
2. Secondary Data types:
- Array
- pointer
- Structure
- Union
- Enumeration Etc.,
Token:
It is a smallest individual part of a program. When you combine individual parts operator, variable, keyword, string,constant etc combining all these will create one single programe.
Variable:
It is a name given to a memory location which holds some quantity or a value that is changed during the program execution.
for eg: In mathematics x is a variable that is x will some value in begining and at the end it will be different. so the value of a variable(varie able) could be changing.
Types of Variables:
- Integer Variable
- eg x=20;
- Float Variable
- eg: x=2.5;
- Character Variables
- x='a';
- String Variables
- x='program'
Rules to use a variable
- A Variable name is any combination of 1 to 8 alphabets, digitst or underscores.
- The first character in a variable name must be an alphabet.
- No commasor blanks are allowed within a variable name.
- No special symbol other than an undescore can be used in a variable.
Constant:
- It is a name given too a memory location which holds some quantity or a value that does not change during the execution. eg: char c=10
- In above example c is variable, = symbol is assignment operator, and 10 is constant.
- Types of Constants:
- Integer Constants: (it takes only integer)
- Float Constants; (it is predefined keyword it takes decimals too)
- Character Constants; (
- String; (group of characters)
- Note: Keywords are the words whose meaning has already been explained to the C Compiler. but keyword cannot be used a s variable names.And also main is not keyword.
- There are many redefined keywords eg:
- auto, double, if, while, for, do, else, char, static, struct, register etc.
INPUT/OUTPUT Instructions:
printf();
scanf();
Structure of C Program:
Header Files
main()
{Variable declaration;
Variable intialization;
Statement 1;
Statement 2;
}
HEADER FILE:Header files are the files which contains the code of inbuild or library functions like printf(), scanf(), getch().
It is the main beginning of the program and these header files have to be used on the top of the program.
Examples of Header Files:
- # include<stdio.h>
- stands for standard input output header file
- # include<conio.h>
- stands for console input output header file
- # include<maths.h>
- used for mathematical functions
- # include<string.h>
- # include<stdlib.h>
- standard library header file
Variable Declaration
Syntax: Datatype Variablename;
Datatype Variable1, Variable2;
example: main()
{
int x;
}
Global Variables:
The variables defined above main() is called global variables. These are accessible to all parts of the program. Global variables can be pre-initialized using = operator.
eg: int sum, count int sum=0, n=10;
main() main ()
{ {
} }
No comments:
Post a Comment
May I Help you