# C Programming Code Examples

## C > Arrays and Matrices Code Examples

C program example read elements in an array and search whether an element exists in the array or not. Program to search an elements in an array linearly. There are two searching

C Program to Segregate 0s on left side and 1s on right side of the Array (Traverse Array only once). Function to segregate all 0s on left and all 1s on right. Increment left index while we

Program code to read elements in an array and sort elements of the array in ascending order. Read unsorted integer values in array and sort them in ascending order. Numerous

C program to input elements in an array from user and sort all even and odd elements of the given array separately without using any other array. If minimum element of the array

C Program sorts the numbers in ascending order using bubble sort. Bubble sort is simple sorting algorithm that works by repeatedly stepping through list to be sorted, comparing

Program code sorts the rows of the matrix in ascending & columns in descending order. This program accepts matrix. Then sorts the row in an ascending order & the columns in

Program code splits an array from specified position & add first part to the end. program first accepts an array. And then splits an array according to the user specification. Now it...

C language read elements in two matrices and find the difference of two matrices. Subtract two matrices in C. Elements of two matrices can only be subtracted if and only...

This C Program takes n number of elements from user and stores it in array arr[]. To find the largest element, the first two elements of array are checked and largest of these two...

Pointer var1 is pointing to the first element of the array and the var2 is the size of the array. In the loop we are incrementing pointer so that it points to the next element of the array

When we pass the address of an array while calling a function then this is called function call by reference. When we pass an address as an argument, the function declaration...

For loop to print value and address of each element of array. Just to demonstrate that the array elements are stored in contiguous locations, I am displaying the addresses in...

C program to read elements in a matrix and find determinant of the given matrix. Find determinant of a 2x2 matrix and 3x3 matrix. Logic to find determinant of a matrix in C.

C program code shall help you learn one of basics of arrays. Copying an array involves index-by-index copying. For this to work we shall know the length of array in advance,...

To divide an array into two, we need at least three array variables. We shall take an array with continuous numbers and then shall store the values of it into two different variables...

Finding largest value in an Array is a classic C array program. Code gives you an insight of iteration, array & conditional operators. We iteratively check each element of an array if

Finding smallest value in an Array is a classic C array program. C code gives you an insight of iteration, array and conditional operators. We iteratively check each element of array...

Read elements in an array and find the sum of all elements of the array. C code find sum of elements of the array. Add elements of an array using for loop in C programming. Logic

C program will let you understand that how to print an array in C. Declare and define one array and then loop upto the length of array. At each iteration we shall print one index...

Print an array in reverse order, we shall know the length of the array in advance. We can start an iteration from length value of array to zero and in each iteration we can print...

C reverse array without using another array relies on the above logic. What we need to do is maintain two array indexes. arrIndex that moves from size - 1 to 0. revIndex that moves

C program just print array in reversed order. It does not reverses the array. Here I am writing the first basic logic to reverse an array. It uses above approach to access array element in...

How to reverse copy array in C programming language. This program code shall help you learn one of basics of arrays. We shall copy one array into another array but in reverse.

Finding the second largest value in an array is a classic C array program. Program gives you an insight of iteration, array and conditional operators. We iteratively check each element

Program code demonstrates how to store the elements entered by user in a 2d array and how to display the elements of a 2D array. Two dimensional array in C programming is

Page 1 Page 2 Page 3 Page 4