Tutorials, Free Online Tutorials,It Challengers provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, core java, sql, php, c language etc. for beginners and professionals.

Breaking

C Program to Delete an element from the specified location from Array

C Program to Delete an element from the specified location from Array

#include<stdio.h>
 
inint main() {
   int arr1[30], arr2[30], i, num;
 
   printf("\nEnter no of elements :");
   scanf("%d", &num);
 
   //Accepting values into Array
   printf("\nEnter the values :");
   for (i = 0; i < num; i++) {
      scanf("%d", &arr1[i]);
   }
 
   /* Copying data from array 'a' to array 'b */
   for (i = 0; i < num; i++) {
      arr2[i] = arr1[i];
   }
 
   //Printing of all elements of array
   printf("The copied array is :");
   for (i = 0; i < num; i++)
      printf("\narr2[%d] = %d", i, arr2[i]);
 
   return (0);
}

Output :

Enter no of elements : 5 Enter the values : 11 22 33 44 55 The copied array is : 11 22 33 44 55

No comments:

Post a Comment