OVERVIEW OF "C" PROGRAMMING (PART-II)
IDENTIFIERS
Identifiers are names of variables, functions, and arrays. They are user-defined names, consisting sequence of letters and digits, with the letter as the first character.
CONSTANTS
Values do not change during the execution of the program Types:
1. Numerical constants:
a) Integer constants
These are the sequence of numbers from 0 to 9 without decimal points or fractional part or any other symbols. It requires a minimum of two bytes and a maximum of four bytes.
E.g.: 10, 20, + 30, – 14
b) Real constants
It is also known as floating point constants.
Eg: 2.5, 5.342
2. Character constants:
a) Single character constants
A character constant is a single character. Characters are also represented with a single digit or a single special symbol or white space enclosed within a pair of single quote marks
Eg: ‘a’, ‘8’, “ ”.
b) String constants
String constants are the sequence of characters enclosed within double quote marks.
Eg: “Hello”, “india”, “444”
VARIABLES
It is a data name used for storing a data value. Its value may be changed during the program execution. The value of variables keeps on changing during the execution of a program.
DATA TYPES
OPERATORS
It indicates an operation to be performed on data that yields value.
Types
INPUT AND OUTPUT
Reading data from input devices and displaying the results on the screen are the two main tasks of any program.
Formatted Functions
— The formatted input/output functions read and write all types of values
Input Output
Scanf() printf()
Unformatted Functions
— The unformatted input/output functions only work with the character data type.
Input Output
getch() putch()
getche() putchar()
getchar() put()
gets()
DECISION STATEMENTS
It checks the given condition and then executes its sub-block. The decision statement decides the statement to be executed after the success or failure of a given condition.
Types:
a) If statement
b) If-else statement
c) Nested if-else statement
d) Break statement
e) Continue statement
f) Go to statement
g) Switch() statement
h) Nested switch () case
i) Switch() case and Nested if
LOOP CONTROL STATEMENTS
Loop is a block of statements which are repeatedly executed for certain number of times.
Types
a) For loop
b) Nested for loops
c) While loop
d) do while loop
e) do-while statement with while loop
ARRAYS
It is a collection of similar data types in which each element is located in separate memory locations.
Types
a) One dimensional array
b) Two-dimensional arrays
c) Three or multi-dimensional arrays
Operations
a) Insertion
b) Deletion
c) Searching
d) Sorting
e) Merging
STRINGS
Character arrays are called strings. Group of characters, digits, symbols enclosed within quotation marks are called as strings.
String Standard Function
FUNCTIONS
It is a self-contained block or a subprogram of one or more statements that performs a special task.
Declaration of functions
Function_name (argument/parameter)
Argument declaration;
{
Local variable declaration;
Statement1;
Statement 2;
Return (value);
}
Call by value
In this type, value of actual arguments is passed to the formal arguments and the operation is done on the formal arguments. Any change made in the formal argument does not affect the actual arguments because formal arguments are photo copies of actual arguments.
Call by reference
In this type, instead of passing values, addresses are passed. Function operates on address rather than values. Here the formal arguments are pointers to the actual argument