Created
September 21, 2016 11:13
-
-
Save devils-ey3/79dfef7446993a265daa5451688d07a5 to your computer and use it in GitHub Desktop.
Delete a number from an array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main () | |
{ | |
int array [100]; | |
int maxi_index,j; | |
scanf("%d",&maxi_index); | |
array [maxi_index]; | |
for (j=0;j<maxi_index;j++) | |
scanf("%d",&array [j]); | |
int read_value,read_index; | |
// printf("Give value : "); | |
// scanf("%d",&read_value); | |
printf("Give the index number : "); | |
scanf("%d",&read_index); | |
if (read_index>=maxi_index) | |
{ | |
maxi_index--; | |
} | |
else | |
{ | |
for (j=read_index;j<maxi_index;j++) | |
{ | |
array[j-1]=array[j]; | |
} | |
maxi_index--; | |
} | |
for (j=0;j<maxi_index;j++) | |
printf("%d ",array[j]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment