instanceof java
Posts: 576
Nickname: instanceof
Registered: Jan, 2015
instanceof java is a java related one.
C program to insert an element in an array
Posted: Sep 3, 2017 1:51 AM
This post originated from an RSS feed registered with Java Buzz
by instanceof java.
Original Post: C program to insert an element in an array
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java
Advertisement
Program to insert an element in an array at a given position C program to insert an element in an array without using function
Program #1: Write a c program to insert an element in array without using function #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int insarray[100], pos, c, n, value; printf("Enter number of elements of array\n"); scanf("%d", &n); printf("Enter all %d elements\n", n); for (c = 0; c < n; c++) scanf("%d", &insarray[c]); printf("Enter the specific position where you wish to insert an element in array\n"); scanf("%d", &pos); printf("Enter the value to insert\n"); scanf("%d", &value); for (c = n - 1; c >= pos - 1; c--) insarray[c+1] = insarray[c]; insarray[pos-1] = value; printf("Resultant array is\n"); for (c = 0; c <= n; c++) printf("%d\n", insarray[c]); getch(); } Output:
Read: C program to insert an element in an array