To write a program in C to insert an element at end of an Array, First of all, we will find the last index of elements. After finding the last index we will add one index and insert an element.
Programming logic and working of insertion program in c at end
- Our Program will take size of the array and an element that need to insert in the array at end.
- Now to insert element at the end of array we will just insert at the last index directly.
- Becuase we already know the index number till element is filled in the array.
C program to insert an element at end of an Array
#include <stdio.h> void main() { int position, i, n, value,ch, arr[100]; printf("C Program to insert element at end of Array\n"); printf("First enter number of elements you want in Array\n"); scanf("%d", &n); arr[n]; for(i = 0; i < n; i++) { printf("Please give value for index %d : ",i); scanf("%d",&arr[i]); } printf("Let's Insert Element at end \n "); printf("Please give a number to insert at end \n"); scanf("%d", &value); arr[n] = value; printf("Element %d is inserted at %d index \n",value,n); printf("New Array is \n "); for(i = 0; i < n+1; i++) { printf("%d \t",arr[i]); } }
Output

Also Prepare Below Important Question
- Python Program to add two number using Recursion
- Python Program to Find Highest Frequency Element in Array
- Python Program to Merge two Arrays
- Perform left rotation by two positions in Array Using Python
- Python Program to Delete Element at Given Index in Array
- Python Program to Delete element at End of Array
- Python Program to Copy one String to Another String
- Python Program to Remove Repeated Character from String
- Print highest frequency Character in String in Python
- Python Program to Convert lowercase vowel to uppercase
- Convert Celsius to Fahrenheit in Python
- Leap Year Program in Python
- Python Program to convert Decimal to Octal number
- Python Program to Convert Decimal Number into Binary
- Find all Pairs Whose Sum is Equal to Given number in Python
- Python Program to Replace First Vowel With ‘-‘ in String
- Python Program to find Prime factors of given integer
- Python Program to Print Prime Number in given range
- Java Program to Perform Left Rotation on Array Elements by Two
- Java Program to Perform Right Rotation on Array Elements by Two
Interview Questions Categories
C Programming Interview Preparation
Core Java Programming Interview Preparation
- Core Java Programming Coding Questions
- Core Java Pattern Programming Questions
- Core Java Programming Interview Questions