Array C/C++ Programs Last Updated : 22 May, 2024 Comments Improve Suggest changes Like Article Like Report C Program to find sum of elements in a given arrayC program to find largest element in an arrayC program to multiply two matricesC/C++ Program for Given an array A[] and a number x, check for pair in A[] with sum as xC/C++ Program for Majority ElementC/C++ Program for Find the Number Occurring Odd Number of TimesC/C++ Program for Largest Sum Contiguous SubarrayC/C++ Program for Find the Missing NumberC/C++ Program for Search an element in a sorted and pivoted arrayC/C++ Program for Merge an array of size n into another array of size m+nC/C++ Program for Median of two sorted arraysC/C++ Program for Write a program to reverse an arrayC/C++ Program for Program for array rotationC/C++ Program for Reversal algorithm for array rotationC/C++ Program for Block swap algorithm for array rotationC/C++ Program for Maximum sum such that no two elements are adjacentC/C++ Program for Leaders in an arrayC/C++ Program for Sort elements by frequency | Set 1C/C++ Program for Count Inversions in an arrayC/C++ Program for Two elements whose sum is closest to zeroC/C++ Program for Find the smallest and second smallest element in an arrayC/C++ Program for Check for Majority Element in a sorted arrayC/C++ Program for Maximum and minimum of an array using minimum number of comparisonsC/C++ Program for Segregate 0s and 1s in an arrayC/C++ Program for k largest(or smallest) elements in an array | added Min Heap methodC/C++ Program for Maximum size square sub-matrix with all 1sC/C++ Program for Maximum difference between two elements such that larger element appears after the smaller numberC/C++ Program for Union and Intersection of two sorted arraysC/C++ Program for Floor and Ceiling in a sorted arrayC/C++ Program for A Product Array PuzzleC/C++ Program for Segregate Even and Odd numbersC/C++ Program for Find the two repeating elements in a given arrayC/C++ Program for Sort an array of 0s, 1s and 2sC/C++ Program for Find the Minimum length Unsorted Subarray, sorting which makes the complete array sortedC/C++ Program for Find duplicates in O(n) time and O(1) extra spaceC/C++ Program for Equilibrium index of an arrayC/C++ Program for Which sorting algorithm makes minimum number of memory writes?C/C++ Program for Turn an image by 90 degreeC/C++ Program for Search in a row wise and column wise sorted matrixC/C++ Program for Next Greater ElementC/C++ Program for Check if array elements are consecutive | Added Method 3C/C++ Program for Find the smallest missing numberC/C++ Program for Count the number of occurrences in a sorted arrayC/C++ Program for Interpolation search vs Binary searchC/C++ Program for Given an array arr[], find the maximum j – i such that arr[j] > arr[i]C/C++ Program for Maximum of all subarrays of size k (Added a O(n) method)C/C++ Program for Find whether an array is subset of another array | Added Method 3C/C++ Program for Find the minimum distance between two numbersC/C++ Program for Find the repeating and the missing | Added 3 new methodsC/C++ Program for Print a given matrix in spiral formC/C++ Program for A Boolean Matrix QuestionC/C++ Program for Median in a stream of integers (running integers)C/C++ Program for Find a Fixed Point in a given arrayC/C++ Program for Maximum Length Bitonic SubarrayC/C++ Program for Find the maximum element in an array which is first increasing and then decreasingC/C++ Program for Count smaller elements on right sideC/C++ Program for Minimum number of jumps to reach endC/C++ Program for Implement two stacks in an arrayC/C++ Program for Find subarray with given sumC/C++ Program for Dynamic Programming | Set 14 (Maximum Sum Increasing Subsequence)C/C++ Program for Longest Monotonically Increasing Subsequence Size (N log N)C/C++ Program for Find a triplet that sum to a given valueC/C++ Program for Find the smallest positive number missing from an unsorted arrayC/C++ Program for Find the two numbers with odd occurrences in an unsorted arrayC/C++ Program for The Celebrity ProblemC/C++ Program for Dynamic Programming | Set 15 (Longest Bitonic Subsequence)C/C++ Program for Find a sorted subsequence of size 3 in linear timeC/C++ Program for Largest subarray with equal number of 0s and 1sC/C++ Program for Dynamic Programming | Set 18 (Partition problem)C/C++ Program for Maximum Product SubarrayC/C++ Program for Find a pair with the given differenceC/C++ Program for Replace every element with the next greatestC/C++ Program for Dynamic Programming | Set 20 (Maximum Length Chain of Pairs)C/C++ Program for Find four elements that sum to a given value | Set 1 (n^3 solution)C/C++ Program for Find four elements that sum to a given value | Set 2 ( O(n^2Logn) Solution)C/C++ Program for Sort a nearly sorted (or K sorted) arrayC/C++ Program for Maximum circular subarray sumC/C++ Program for Find the row with maximum number of 1sC/C++ Program for Median of two sorted arrays of different sizesC/C++ Program for Print unique rows in a given boolean matrixC/C++ Program for Shuffle a given arrayC/C++ Program for Count the number of possible trianglesC/C++ Program for Iterative Quick SortC/C++ Program for Inplace M x N size matrix transpose | UpdatedC/C++ Program for Find the number of islandsC/C++ Program for Construction of Longest Monotonically Increasing Subsequence (N log N)C/C++ Program for Find the first circular tour that visits all petrol pumpsC/C++ Program for Arrange given numbers to form the biggest numberC/C++ Program for Dynamic Programming | Set 27 (Maximum sum rectangle in a 2D matrix)C/C++ Program for Pancake sortingC/C++ Program for A Pancake Sorting ProblemC/C++ Program for Tug of WarC/C++ Program for Print Matrix DiagonallyC/C++ Program for Divide and Conquer | Set 3 (Maximum Subarray Sum)C/C++ Program for Counting SortC/C++ Program for Merge Overlapping IntervalsC/C++ Program for Find the maximum repeating number in O(n) time and O(1) extra spaceC/C++ Program for Stock Buy Sell to Maximize ProfitC/C++ Program for Rearrange positive and negative numbers in O(n) time and O(1) extra spaceC/C++ Program for Sort elements by frequency | Set 2C/C++ Program for Find a peak elementC/C++ Program for Print all possible combinations of r elements in a given array of size nC/C++ Program for Given an array of of size n and a number k, find all elements that appear more than n/k timesC/C++ Program for Find the point where a monotonically increasing function becomes positive first timeC/C++ Program for Find the Increasing subsequence of length three with maximum productC/C++ Program for Find the minimum element in a sorted and rotated arrayC/C++ Program for Stable Marriage ProblemC/C++ Program for Merge k sorted arrays | Set 1C/C++ Program for Radix SortC/C++ Program for Move all zeroes to end of arrayC/C++ Program for Find number of pairs such that x^y > y^xC/C++ Program for Count all distinct pairs with difference equal to kC/C++ Program for Count all possible paths from top left to bottom right of a mXn matrixC/C++ Program for Suffix Array | Set 1 (Introduction)C/C++ Program for Rearrange an array so that arr[i] becomes arr[arr[i]] with O(1) extra spaceC/C++ Program for Sort n numbers in range from 0 to n^2 – 1 in linear timeC/C++ Program for Count all possible groups of size 2 or 3 that have sum as multiple of 3C/C++ Program for Binary SearchC/C++ Program for Selection SortC/C++ Program for Bubble SortC/C++ Program for Insertion SortC/C++ Program for Merge SortC/C++ Program for Heap SortC/C++ Program for QuickSort Comment More infoAdvertise with us Next Article Array C/C++ Programs R rahulsharmagfg1 Follow Improve Article Tags : C Programs C++ Programs C Language C++ c-array cpp-array C++ Array Programs C Array Programs +4 More Practice Tags : CPP Similar Reads C Arrays An array in C is a fixed-size collection of similar data items stored in contiguous memory locations. It can be used to store the collection of primitive data types such as int, char, float, etc., as well as derived and user-defined data types such as pointers, structures, etc. Creating an Array in 7 min read Properties of Array in C An array in C is a fixed-size homogeneous collection of elements stored at a contiguous memory location. It is a derived data type in C that can store elements of different data types such as int, char, struct, etc. It is one of the most popular data types widely used by programmers to solve differe 8 min read Length of Array in C The Length of an array in C refers to the maximum number of elements that an array can hold. It must be specified at the time of declaration. It is also known as the size of an array that is used to determine the memory required to store all of its elements.In C language, we don't have any pre-defin 3 min read Multidimensional Arrays in C - 2D and 3D Arrays A multi-dimensional array in C can be defined as an array that has more than one dimension. Having more than one dimension means that it can grow in multiple directions. Some popular multidimensional arrays include 2D arrays which grows in two dimensions, and 3D arrays which grows in three dimension 8 min read Initialization of Multidimensional Array in C In C, multidimensional arrays are the arrays that contain more than one dimensions. These arrays are useful when we need to store data in a table or matrix-like structure. In this article, we will learn the different methods to initialize a multidimensional array in C. The easiest method for initial 4 min read Jagged Array or Array of Arrays in C with Examples Prerequisite: Arrays in CJagged array is array of arrays such that member arrays can be of different sizes, i.e., we can create a 2-D array but with a variable number of columns in each row. These type of arrays are also known as Jagged arrays. Example:arr[][] = { {0, 1, 2}, {6, 4}, {1, 7, 6, 8, 9}, 3 min read Pass Array to Functions in C Passing an array to a function allows the function to directly access and modify the original array. In this article, we will learn how to pass arrays to functions in C.In C, arrays are always passed to function as pointers. They cannot be passed by value because of the array decay due to which, whe 3 min read How to pass a 2D array as a parameter in C? A 2D array is essentially an array of arrays, where each element of the main array holds another array. In this article, we will see how to pass a 2D array to a function.The simplest and most common method to pass 2D array to a function is by specifying the parameter as 2D array with row size and co 3 min read How to pass an array by value in C ? In C programming, arrays are always passed as pointers to the function. There are no direct ways to pass the array by value. However, there is trick that allows you to simulate the passing of array by value by enclosing it inside a structure and then passing that structure by value. This will also p 2 min read Variable Length Arrays (VLAs) in C In C, variable length arrays (VLAs) are also known as runtime-sized or variable-sized arrays. The size of such arrays is defined at run-time.Variably modified types include variable-length arrays and pointers to variable-length arrays. Variably changed types must be declared at either block scope or 2 min read Like