C Programs on Arrays

C Programming Examples - Arrays

In C programming, an array is a variable that can store multiple values ​​in a single variable rather than having separate variables for each element. It is one of the simplest data structures where each data item can be accessed randomly using its index number. Arrays are used to store a collection of primitive data types like int, float, double, char, etc., as well as derived data types like structures and pointers.

The following section contains various C programs on Arrays with examples such as array operations, types of array, single-dimensional arrays, mathematical functions on arrays, sort, and merging operations. It also includes programs for inserting and removing elements from an array. Each sample program on the Array includes a program description, C code, and program output. All Array C examples have been compiled and tested on Windows and Linux systems.

Here is the listing of C programming examples on Array:

  1. C Programs on Largest & Smallest Numbers in an Array
  2. C Programs on Inserting & Deleting Elements from an Array
  3. C Programs on Array
  4. C Programs on Array Operations
  5. C Programs on Array Mathematical Operations
  6. C Programs on Sort and Merge Operations on an Array
  7. C Programs on Printing the Elements of an Array
  8. C Programs on Math Functions and their Applications on Arrays

1. C Programs on Largest & Smallest Numbers in an Array

Program Description
Largest Element in Array in C C Program to Find Largest Element in an Array
Find Largest Two Numbers in Array in C C program to Find Largest and Second Largest Elements in Array
Second Largest and Smallest Element of an Array in C C Program to Find Second Largest and Smallest Elements of an Array
Largest Element in an Array using Recursion in C C Program to Find Largest Element in an Array using Recursion
Maximum Difference b/w Two Elements in C C Program To Find Maximum Difference Between Two Elements in an Array

advertisement
advertisement

2. C Programs on Inserting & Deleting Elements from an Array

Program Description
Insert an Element in the Sorted Array in C C program to Insert an Element in the Sorted Array
Insert an Element in an Array in C C program to Insert an Element in an Array
Delete an Element from an Array in C C program to Delete an Element from an Array
Remove Duplicates from Array in C C Program to Remove Duplicate Elements from an Array
Reverse an Array in C C Program to Reverse an Array
Separate Odd and Even Numbers from an Array in C C Program to Separate Odd and Even Numbers from an Array
Cyclically Permute the Elements of an Array in C C Program to Cyclically Permute the Elements of an Array

3. C Programs on Array

Program Description
Find Number of Elements in an Array in C C Program to Find the Number of Elements in an Array
Non Repeated Elements in an Array in C C Program to Print all Non Repeated Elements in an Array
Find Missing Numbers in Array in C C Program to Find Missing Numbers in Array
Find Missing Numbers of a Range [1, n] in C C Program to Find Missing Numbers in an Array of Size N-1 with Numbers[1,N]
Array Bounds Checking in C C Program to Check Array bounds while Inputting Elements into the Array
Count Occurrences of C Keyword using Array in C C Program to Count the Occurrences of Each Keyword using Array Structure
Two Odd Occurring Elements in an Array in C C Program to Find Two Odd Occurring Elements in an Array
Bit Array in C C Program to Implement Bit Array
Variable Length Array in C C Program to Implement Variable Length Array
Find Mode of an Array in C C Program to Find Mode of an Array

4. C Programs on Array Operations

Program Description
Swap Array Elements using Pointers in C C Program to Swap Elements in an Array using Pointers
Split an Array & Add First Part to the End in C C Program to Split the Array and Add First Part to the End
Search an Element in an Array using Recursion in C C Program to Search an Element in an Array using Recursion
Segregate 0s and 1s in an Array in C C Program to Segregate 0s and 1s in an Array
Increment an Array by One in C C Program to Increment All Elements of an Array by One

5. C Programs on Array Mathematical Operations

Program Description
Sum and Average of Array Elements in C C Program to Find Sum of Array Elements
Sum of Array Elements using Pointer in C C Program to Find Sum of Array Elements using Pointer
Sum of Array Elements using Pointer as Arguments in C C Program to Find Sum of Array Elements using Pointer as Arguments
Addition of One Dimensional Array in C C Program to Find Sum of two One-Dimensional Arrays using Malloc
Largest Sum Contiguous Subarray in C C Program to Find the Largest Sum of Contiguous Subarray of an Array

6. C Programs on Sort and Merge Operations on an Array

Program Description
Sort the Array in Ascending Order in C C Program to Sort an Array in Ascending Order
Sort the Array in Descending Order in C C Program to Sort an Array in Descending Order
Sort Names in Alphabetical Order in C C Program to Sort N Names in an Alphabetical Order
Merge two Sorted Arrays in C C Program to Merge Two Sorted Array Elements
Merge and Sort Two Arrays in C C Program to Implement Merge Sort Algorithm

7. C Programs on Printing the Elements of an Array

Program Description
Pascal Triangle 1 D Array in C C Program to Generate Pascal Triangle using 1 D Array
Odd and Even Numbers in an Array in C C Program to Print Even and Odd Numbers in an Array
Kth Largest Element in an Array in C C Program to Find the kth Element in an Array
Print Alternate Elements of an Array in C C Program to Print Alternate Elements of an Array
Frequency of all Duplicate Elements in an Array in C C Program to Print All Repeated Elements with Frequency in an Array

advertisement

8. C Programs on Math Functions and their Applications on Arrays

Program Description
Print Square of Array Elements in C C Program to Print the Square of Array Elements
Print Ascii Values using Array in C C Program to Print Ascii Value of a Character using Array
Closest to Zero Program in C C Program To Find Two Elements whose Sum is Closest to Zero
Union & Intersection of 2 Arrays C Program to Find Union and Intersection of Two Arrays

advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.