Five common pointer mistakes in C programming

Pointer is the most important and powerful tool in C language. Pointer resolves many complicated problems easily but if you don’t have the sufficient knowledge of pointers, you will face problems like segmentation fault etc.

In this article, I will describe five common pointer mistakes in C programming which generally occurs.

Read more

C program to multiply two matrix using pointers

Write a C program to multiply two matrix using pointers. How to input and multiply two matrix using pointer in C programming. Logic to multiply two matrix using pointer in C.

Example

Input

Input elements of matrix1:
10 20 30
40 50 60
70 80 90
Input elements of matrix2:
1 2 3
4 5 6
7 8 9

Output

Product of matrices is :
300 360 420
660 810 960
1020 1260 1500

Read more

C program to add two matrix using pointers

Write a C program to add two matrix using pointers. C program to input two matrix from user and find sum of both matrices using pointers.

Example

Input

Input matrix1: 
1 2 3
4 5 6
7 8 9
Input matrix2: 
9 8 7
6 5 4
3 2 1

Output

Sum of both matrices:
10 10 10
10 10 10
10 10 10

Read more

C program to sort an array using pointers

Write a C program to input elements in an array and sort array using pointers. How to sort an array in ascending or descending order using function pointers in C programming. Logic to sort an array using pointers in program.

Example

Input

Input array elements: 10 -1 0 4 2 100 15 20 24 -5

Output

Array in ascending order: -5, -1, 0, 2, 4, 10, 15, 20, 24, 100,
Array in descending order: 100, 24, 20, 15, 10, 4, 2, 0, -1, -5,

Read more

C program to search element in array using pointers

Write a C program to input elements in array and search an element in array using pointers. How to search an element in array using pointers in C programming. Logic to search an element in array using pointers in C program.

Example

Input

Input array elements: 10 20 30 40 50 60 70 80 90 100
Input element to search: 25

Output

25 does not exists in array.

Read more

C program to reverse an array using pointers

Write a C program to input elements in an array and reverse the array using pointers. How to reverse an array using pointers in C programming. Logic to reverse an array using pointers in C.

Example

Input

Input array elements: 10 20 30 40 50 60 70 80 90 100

Output

Reversed array: 100 90 80 70 60 50 40 30 20 10

Read more