Calling and Called function & Actual and formal parameters

Let us take an example:

 

Jump statements

-> Goto [Avoided in normal programming.]

-> Continue

-> Break

-> Return

 

Syntax are as follows:

-Goto:

Only statement2 will be executed and statement 1 won’t be executed as the programs makes a jump to label.

 

-Continue:

Example:

 

In this loop statement1 gets executed and statement2 will not be executed!

Continue statement after statement1 takes the control back to the decision making

i.e., foor loop here, and hence it skips the statement2 in each execution till n.

 

-Break:

Eg:

while(condition)

{

printf(“hi”);

break;

printf(“hello”)

}

 

This program prints hi and won’t print hello because before it moves to the

statement which prints hello break is encountered which beings the control out of the while loop and hence only hi is printed.

 

-Return:

return(value)

Eg:

main()

{

return(0)

}

It returns 0 to the main function.

 

 

 

Sentinel loops

In sentinel loops we don’t know that how many no. of times the loop will work!

That means that a sentinel loop can be regarded as infinite, indefinite loop.

For Eg:

 

Output will be an infinite loop printing “This is an infinite loop!” infinitely!! 🙂

Precedence order in aritmetic operators in c

Precedence of aritmetic operators is as follows:

*   /   % +   –       –> Multiplication, division, modulo, addition & subtraction at the end!

For Eg:

If we run a program with following code:

It will solve the following way:

x= 5/4+6 – 4%2 + 5/2

Next,

x=1 + 6 – 4%2 + 2

5/4 will come out to be 1 & 5/2 will come out to be 2 because we have declared x as integer not as a float!

Next,

x=1+6-0+2

Finally,

x=72=9!

This implies x=9 will be the answer and hence output will be:

 

Program to find sum of diagonals in a 2D matrix using pointers

 

OUTPUT:

 

 

 

 

 

 

 

 

OUTPUT:

 

Copy a character array in another character array using pointers and without using inbuilt function

OUTPUT:

Copy

To perform following operations: -> Addition of two matrices, Transpose & Sum of upper and lower triangular

Program:

OUTPUT:

Matrix operations

Program to enter n set of elements inside 1-D array and arrange these elements using bubble sort & selection sort.

Selection Sort:

 

Bubble Sort:

 

Output [Selection Sort]:

selection

Output [Bubble Sort]:

bubble

Program to calculate no. of alphabets, digits & white spaces using user defined functions along with pointers.

 

OUTPUT [Click to enlarge]:

white space

Program to perform String length, reverse, comapre, concatinate & Upper case and lower case using user defined functions along with pointers.

 

 

OUTPUT: [Click to enlarge]:

string operations