×

C Programs

C Basic & Conditional Programs

C Looping Programs

C String Programs

C Miscellaneous Programs

One Dimensional Array Programs / Examples in C programming language

One Dimensional (One-D) Array Programs / Examples - This section contains solved programs on One Dimensional Array, here you will learn about declaration, initialisation of the array and other basic and advanced operations on array like reading, printing array elements, sum and product of array elements, merging two arrays, adding and subtracting two arrays elements, swapping adjacent elements, sorting, searching etc.

All programs have explanation and output on different possible input values. We tried to make programs simple and using different method.

List of One Dimensional Array Programs / Examples in C

  1. Initialising byte array with decimal, octal and hexadecimal numbers in C
    Here, we are going to learn how to declare byte array and initialise array with decimal, octal and hexadecimal numbers in C language.
  2. C program to count Array elements by using sizeof() operator
    In this C program, we will learn how to count the total number of elements in a one dimensional array using sizeof() operator?
  3. C program to swap first element with last, second to second last and so on (reversing elements)
    In this C program, we are going to swap array elements (like, first element with last, second element with second last and so on... i.e. reversing the array elements).
  4. C program to find nearest lesser and greater element in an array
    In this C program, we are going to learn how to find nearest lesser and greater element in an array? Here, given array have N elements.
  5. C program to merge two arrays in third array which is creating dynamically
    In this C program, we are merging two one dimensional array in third array, where size of first and second arrays are different and the size of third array will be size of first array + second array.
  6. C program to calculate median of an array
    In this C program, we are going to learn how to find the median of an array? Here, we are reading N elements and finding their median element.
  7. C program to delete prime numbers from an array
    In this C program, we are going to learn how can we check and delete prime numbers from an array? We are declaring an array with some prime and non prime numbers and deleting prime numbers and then printing array elements with the numbers which are not prime.
  8. C program to check prime numbers in an array
    In this C program, we are going to learn to check prime numbers in an array. We will declare an array with some prime and non prime numbers, and then print the elements with “prime” and “Not prime” message.
  9. C program to create array with reverse elements of one dimensional array
    In this C program, we are going to learn how to create an array with reverse elements of given array? Here, we have an array with some integer elements and we have to create another array by assigning elements of first array in reverse order.
  10. C program to count total number of elements divisible by a specific number in an array
    Here, we are implementing a c program that will count total number of elements divisible by a specific number in an array.
  11. C program to create a new array from a given array with the elements divisible by a specific number
    Here, we are implementing a c program that will create a new array from a given array with the elements divisible by a specific number in an array.
  12. C program to find second largest elements in a one dimensional array
    In this article, we are going to write a C program to find the second maximum element from one dimensional array.
  13. C program to find two largest elements in a one dimensional array
    Here, we are implementing a C program that finds the two largest numbers from a one dimensional array.
  14. C program to find second smallest element in a one dimensional array
    Here, we are implementing a C program that will read a one dimensional array of integers and find the second smallest element it.
  15. C program to find two smallest elements in a one dimensional array
    In this article we are going to implement a C program to find two smallest elements in a one dimensional array.
  16. C Program to Cyclically Permute the Elements of an Array
    Here, we are implementing a C program, which will cyclically permute the elements of an array.
  17. C program to accept Sorted Array and do Search using Binary Search
    Here, we are going to learn how to perform binary search on a sorted array: Here, a sorted array is given and we have to perform binary search on it.
  18. C Program to find the Biggest Number in an Array of Numbers using Recursion
    Here, we are going to implement a C program to find the biggest number in an array of numbers using recursion.
  19. C program to print the number of subset whose elements have difference 0 or 1
    Here, we are going to learn how to print the number of subset whose elements have difference 0 or 1 using C program?
  20. C program to read and print One Dimensional Array of integer elements
    This program will read and print 10 elements of integer type using One Dimensional Array. To read and print 10 elements we will run loop from index 0 to 9 because first elements stores at index 0 and this index is called base index of the array.
  21. C program to calculate Sum, Product of all elements
    This program will read N One Dimensional Array Elements, and calculate the Sum and Product of all elements and print the sum and product.
  22. C program to find Smallest and Largest elements from One Dimensional Array Elements
    This program will read 10 elements and find the smallest and largest elements from inputted One Dimensional Array Elements.
  23. C program to replace all EVEN elements by 0 and Odd by 1 in One Dimensional Array
    This program will read 10 elements of integer type using One Dimensional Array and replace all EVEN elements by 0 and ODD by 1.
  24. C program to merge Two One Dimensional Arrays elements
    This program will read Two One Dimensional Array of same data type (integer type) and merge them into another One Dimensional Array of same type.
  25. C program to Add and Subtract of Two One Dimensional Array elements
    This program will read two One Dimensional Array and create third One Dimensional Array by adding and subtracting elements of inputted two One Dimensional Array elements.
  26. C program to find a number from array elements
    In this program, we are reading an array of integers and a number to find it from the given array elements.
  27. C program to sort array elements in ascending order
    In this program, we are reading an array of integers and sorting array elements in ascending order.
  28. C program to reverse array element
    This C program will read N array elements and reverse them, this will print reversed array elements.
  29. C program to swap adjacent elements of a one dimensional array
    Given N array elements and we have to swap adjacent elements using C program.
  30. C program to find occurrence of an element in one dimensional array
    Here, we are going to learn how to find occurrence of an element in one dimensional array in C programming language?
  31. C program to sort an one dimensional array in ascending order
    Given an array with N integer elements and we have sort them in ascending order.
  32. C program to sort an one dimensional array in descending order
    Given an array with N integer elements and we have sort them in descending order.
  33. C program to delete given element from one dimensional array
    Given an array with N integer elements and we have to delete given element from the array using C program.
  34. C program to find the first repeated element in an array
    This program will read 5 integer numbers and find first repeated element, program will print the element and its index on which repeated element found.
  35. C program to calculate the sum of array elements using pointers as an argument
    Here, we are going to learn how to calculate the sum of array elements using pointers as an argument in C programming language?
  36. C program to add two dynamic arrays
    Here, we are going to learn how to add two dynamic arrays in C programming language?
  37. C program to find the sum of the largest contiguous subarray
    Here, we are going to learn how to find the sum of the largest contiguous subarray in C programming language?
  38. C program to split an array and add the first half after the second half of the array
    Here, we are going to learn how to split an array and add the first half after the second half of the array in C programming language?
  39. C program to generate pascal triangle using the array
    Here, we are going to learn how to generate Pascal Triangle using the array in C programming language?
  40. C program to access array element out of bounds
    Here, we are going to learn how to access array element out of bounds in C programming language?
  41. C program to print alternate elements of the array
    Here, we are going to learn how to print alternate elements of the array in C programming language?
  42. C program to print the non-repeated elements of an array
    Here, we are going to learn how to print the non-repeated elements of an array in C programming language?
  43. C program to find the total of non-repeated elements of an array
    Here, we are going to learn how to find the total of non-repeated elements of an array in C programming language?
  44. C program to find the missing number in the array
    Here, we are going to learn how to find the missing number in the array in C programming language?
  45. C program to find the missing number in the array using the bitwise XOR operator
    Here, we are going to learn how to find the missing number in the array using the bitwise XOR operator in C programming language?
  46. C program to segregate 1's and 0's in the array
    Here, we are going to learn how to segregate 1's and 0's in the array in C programming language?
  47. C program to find the difference between the largest and smallest element in the array
    Here, we are going to learn how to find the difference between the largest and smallest element in the array in C programming language?
  48. C program to print the square of array elements
    Here, we are going to learn how to print the square of array elements in C programming language?
  49. C program to find two elements whose sum is closest to zero
    Here, we are going to learn how to find two elements whose sum is closest to zero in C programming language?
  50. C program to check a given number appears more than N/2 times in a sorted array of N integers
    Here, we are going to learn how to check a given number appears more than N/2 times in a sorted array of N integers in C programming language?
  51. C program to find the median of two sorted arrays with same using simple merge-based O(n) solution
    Here, we are going to learn how to find the median of two sorted arrays with same using simple merge-based O(n) solution in C programming language?
  52. C program to find the median of two arrays using a divide and conquer-based efficient solution
    Here, we are going to learn how to find the median of two arrays using a divide and conquer-based efficient solution in C programming language?
  53. C program to find the intersection of two arrays
    Here, we are going to learn how to find the intersection of two arrays in C programming language?
  54. C program to find the union of two arrays
    Given two integer arrays, we have to find the union using C program.
  55. C program to find the size of the array using macro
    Given an array, we have to create a macro to find the size of the given array using C program.
  56. C program to find the ceiling element of the given number in the sorted array
    Given a sorted array arr[] and a number item, the ceiling of the item is the smallest element in array arr[] greater than or equal to item. We have to find the ceiling value of the given number in the sorted array using C program.
  57. C program to find the floor element of the given number in the sorted array
    Given a sorted array arr[] and a number item, the floor of the item is the greatest element smaller than or equal to item. We have to find the floor value of the given number in the sorted array using C program.
  58. C program to create an integer array and store the EVEN and ODD elements in a different array
    Here, we will create an integer array then find and store EVEN and ODD elements in two different separate arrays and print them.

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.