Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
831 B
1
Indexable
Never
#include <stdio.h>
#define MAX_SIZE 10
int DeletePos(int array[]);
int main()
{
    int array[MAX_SIZE] = {0};
    for(int i=0; i<10; i++)
    {
        printf("%d. %d\n", i+1, array[i]);
    }
    printf("\n");
    for(int i=0; i<10; i++)
    {
        if(i == 0)
        {
            array[i] = 1;
        }
        else if(i == 3)
        {
            array[i] = 2;
        }
        else if(i == 9)
        {
            array[i] = 3;
        }
        //printf("%d. %d\n", i+1, array[i]);
    }
    DeletePos(array);
    for(int i=0; i<MAX_SIZE; i++)
    {
        printf("%d. %d\n", i+1, array[i]);
    }
    return 0;
}
int DeletePos(int array[])
{
    int pos = 3;
    int size = 11;
    for(int i=pos-1; i<size-1; i++)
    {
        array[i] = array[i+1];
    }
    size++;
}