Thread: how delete 1th element of a sorted array

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    3

    Question how delete 1th element of a sorted array

    how can delete the 1th element of a sorted array?

    anyone can help me..

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You can't "delete" members of arrays. You just have to copy everything past that point, back one.

    1,2,3,4,5
    delete(3)
    1,2,4 <- 4,5 move the four left one
    1,2,4 <- 5,5 move the five left one
    1,2,4,5,5 figure out what you want done with the extra five

    You cannot actually just delete array members.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    3
    thanks

  4. #4
    Registered User
    Join Date
    Oct 2009
    Posts
    3
    explain with c program

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    No. You post your attempt, and we'll help you correct it. I've explained the logic, you give it a try. Hint: Use a loop.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. delete an element from a linked list
    By hinman in forum C Programming
    Replies: 6
    Last Post: 10-17-2007, 08:30 PM
  2. Modify an single passed array element
    By swgh in forum C Programming
    Replies: 3
    Last Post: 08-04-2007, 08:58 AM
  3. 2d array question
    By gmanUK in forum C Programming
    Replies: 2
    Last Post: 04-21-2006, 12:20 PM
  4. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM