# 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.
21. C program to calculate Sum, Product of all elements.
22. C program to find Smallest and Largest elements from One Dimensional Array Elements.
23. C program to replace all EVEN elements by 0 and Odd by 1 in One Dimensional Array.
24. C program to merge Two One Dimensional Arrays elements.
25. C program to Add and Subtract of Two One Dimensional Array elements.
26. C program to find a number from array elements.
27. C program to sort array elements in ascending order.
28. C program to reverse array element.
29. C program to swap adjacent elements of a one dimensional array
30. C program to find occurrence of an element in one dimensional array.
31. C program to sort an one dimensional array in ascending order.
32. C program to sort an one dimensional array in descending order.
33. C program to delete given element from one dimensional array.
34. C program to find the first repeated element in an array.

List of other C programs

1. C program to declare memory for an integer variable dynamically.
Dynamic Memory Allocation Example: In this C program, we are will declare an integer pointer and allocate memory for an integer variable at run time using malloc().
2. C program to read and print name, where memory for variable should be declared at run time.
Dynamic Memory Allocation Example: In this C program, we will declare memory character array (to read name) at run time, will read name and print the string.
3. C program to find sum of array elements using Dynamic Memory Allocation.
Dynamic Memory Allocation Example: In this C program, we will declare memory for array elements (limit will be at run time) using malloc(), read element and print the sum of all elements along with the entered elements.
4. C Program to find the sum of digits of a number until a single digit is occurred.
C Program to find the sum of digits of a number until a single digit is occurred (without using recursion or iterative(loop) statements).
5. C program to find class of an IP Address.
This program will print the class of a given (user input) IP address.
6. Stringizing Operator in C - Program to print variable name in C.
This program will print the variable name using stringizing operator.
7. Function Pointer example program in C programming.
This program demonstrate an example of function pointer in c programming language.
8. C program to get current System Date and Time in Linux.
9. C program to implement gotoxy(),clrscr(),getch(),getche() for GCC, Linux.
10. C program to find the size of a file in Linux.
11. C program to get Process Id and Parent Process Id in Linux.
12. fork() function explanation and examples in Linux C.
13. C program to Get Computer System IP Address in Linux.
14. C program to Set Computer System IP Address in Linux.

15. C program to design flying characters Screen Saver.
16. C program to design a TIC TAC TOE game.
17. Age Calculator (C program to calculate age).
18. C program to design love calculator.
19. C program to guess a random number.

20. C program to check given string is a valid IPv4 address or not.
21. C program to convert String into Hexadecimal.
22. C program to demonstrate example of Variable Arguments.
23. C program to store time in an integer variable.
24. C program to store date in an integer variable.
25. C program to remove consecutive repeated characters from string.
27. EMI Calculator (C program to calculate EMI).
28. C program to validate date (Check date is valid or not).
29. C program to format/extract ip address octets.
30. C program to implement substring function.
31. C program to design a digital clock.
32. C program to convert hexadecimal Byte to integer.
33. C program to extract bytes from an integer (Hexadecimal) value.
34. C program to print character without using format specifiers.
35. C program to find Binary Addition and Binary Subtraction.
36. C program to print weekday of given date.
37. C program to calculate compound interest.

TOP Interview Coding Problems/Challenges

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates