4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

C program to delete an element in an array

Deleting an element refers to the deletion of a single element at particular location in array. We will try to delete this element using c program.

             

Program:


#include<stdio.h>

int main()

{

    int i,p,n,a[20],c[20];

    printf("Enter the value of n:\n");

    scanf("%d",&n);

    printf("Enter the value in 1 :\n");

    for(i=0;i<=n;i++)

    {

        scanf("%d",&a[i]);

    }

    printf("Enter the value of p:\n");

    scanf("%d",&p);

    for(i=p;i<=n;i++)

    {

        a[i]=a[i+1];

    }

     for(i=0;i<=n-1;i++)

    { printf("%d",a[i]);

}

}



1 upvotes $0.00

Replies (0)

Conversation

No replies yet

Replies will appear here as people join the conversation.

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: