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

Continue reading C program to multiply two matrix using pointers

How to access two dimensional array using pointers in C programming?

How to access two dimensional array using pointers in C programming? Write a C program to input and print elements of a two dimensional array using pointers and functions.

Example

Input

Input elements in 3x3 matrix: 
1 2 3
4 5 6
7 8 9

Output

Elements of 3x3 matrix: 
1 2 3
4 5 6
7 8 9

Continue reading How to access two dimensional array using pointers in C programming?

How to pass and return array from function in C?

Functions makes our program modular and maintainable. Big applications can have hundreds of functions.

Array is a data structure to store homogeneous collection of data. Arrays are equally important as functions. In programming we often use arrays and functions together.

Here in this post I will explain how to pass and return array from function in C programming.

Continue reading How to pass and return array from function in C?

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,

Continue reading C program to sort an array using pointers

C program to rotate bits of a number

Write a C program to input a number and rotate bits of number using bitwise shift operators. How to rotate bits of a given number using bitwise operator in C programming. Logic to left or right rotate bits of a number using bitwise shift operator in C program.

Example

Input

Input number = -15
Number of rotations = 2

Output

-15 left rotated 2 times = -57
-15 right rotated 2 times = 2147483644

Continue reading C program to rotate bits of a number

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.

Continue reading C program to search element in array using pointers

C program to swap two arrays using pointers

Write a C program to swap corresponding elements of two arrays using pointers. How to swap two arrays using pointers in C program. Logic to swap two arrays of different length using pointers in C programming.

Example

Input

Input first array: 10 20 30 40 50 60 70 80 90 100
Input second array: 0 9 8 7 6 5 4 3 2 1

Output

First array after swapping: 0 9 8 7 6 5 4 3 2 1
Second array after swapping:  10 20 30 40 50 60 70 80 90 100

Continue reading C program to swap two arrays using pointers

C program to copy one array to another using pointers

Write a C program to copy one array elements to another array using pointers. How to copy array elements from one array to another array using pointers. Logic to copy one array to another array using pointers in C programming.

Example

Input

Input array1 elements: 10 -1 100 90 87 0 15 10 20 30

Output

Array1: 10 -1 100 90 87 0 15 10 20 30
Array2: 10 -1 100 90 87 0 15 10 20 30

Continue reading C program to copy one array to another using pointers