Brief introduction to C Language:-
Languages like B, Combined Programming Language (CPL) and Basic CPL were used popularly.
The B language used earlier was added with basic functionality of BCPL to create C language.
Dennis Ritchie developed C in 1972 while working with Bell Laboratories.
C was developed on unix operating system.
- The most popular example of C application is the re -creation of UNIX operating system.
- C is used to develop compilers, interpreters, graphic and general utilities.
- C has been used in the development of various databases, word processors and spread sheets.
- Power and flexibility has prompted the use of C language in the development of custom – made applications like railway ticket vending machines and applications in the banking and insurance sector.
1. Source code – with ‘.c’ as the extension. It is the file where the program instructions are written.
2. Header File – contains the declaration of functions and the pre-processor commands. It has ‘.h’ as its extension.
3. Object Files – these are the files created by the compiler and have a extension either as ‘.o’ or ‘.obj’.
4. Binary Executables – output from the linking process. The extension of these files is ‘.exe’.The linker is a program that collects all the related object files and creates an executable file.
There are two types of constants.
Rules for creating an Integer constants
- It needs at least one digit.
- No decimal point is present in an Integer constant
- It can be a positive or negative number.
- It does not have commas or blanks
- +31, 56, -75 are instances of Integer constants
Variable:-A value that can vary or can be altered during the execution of the program or instruction is called a variable.
Points to remember when creating a variable:
- The length of the variable name should not exceed more than 8 characters.
- The variable name can be made up of A- Z, a-z, 0-9 or underscores ( _ ), and combination of all these can also be used to create a variable name.
- Precaution should be taken that variable name must begin with an alphabet.
- Special characters (%, # ), commas and blanks are not allowed in variable names.
Syntax to create a variable : int a, b, c; [three variables of integer type]
Data Types in C Language:
- int [Integer]
- char [character or string]
- float [floating point numbers]
- double [double values]
- Arithmetic operators are the basic mathematical operators used for addition, subtraction, multiplication or division.
- An order of precedence is followed when these operators are applied together in an expression.
- sizeof operator returns the size occupied by the variable.
Less than or equal to
Greater than or equal to
Not equal to
= += *= /= -=