#How to remove the first element of a dynamic array

26 messages · Page 1 of 1 (latest)

last knotBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

steady pagoda
#

Format with three backticks followed by the letter c and a newline, then your code, then finally three backticks

#

No spaces between the first three backticks and c

#
/* If you're on the desktop Discord
 * client this should be nicely colored
 */
int main(void) {
    return 0;
}```
#

Backticks, not backslashes

#

Like an apostrophe but kind of tilted backwards a bit

#

Nice, yes

#

That looks like it would work

tame cairn
#

Backtick: `

#

3 backticks: ```
Single quote: '
3 single quotes: '''

steady pagoda
#

Also a blood sucking insect that attaches to your back and transmits diseases

#

I assume

#

There was just a memmove, no looping in the code you pasted

#

And btw paste a full example that compiles if you want help and use globals etc. mystery variables and functions

#

Explaining it like that is useless because the code itself is the only thing that can show what is happening

#

You aren't the judge of what's helpful, it's not possible to reason about code that isn't visible

#

The memmove moves the array one entry so that previous index 1 becomes 0, etc, so the first pid is indeed overwritten, and so are all the rest

#

If that's not enough you have to provide more detail

#

I said explanations are not a replacement for reading the code

#

The basic thing is: you need help with C syntax and/or code. For you to be able to explain the problem in sufficient detail you would need to understand it all well enough to not need to ask.

#

You can't get a car problem diagnosed as a non-mechanic by explaining your impression of your car troubles to the mechanic. He/she needs to look at the actual thing to find out.

steady pagoda
#

Looks like uninitialized memory maybe

#

Are you updating all the pointers you use to refer to the array? Realloc can change the address.

steady pagoda
#

Again not enough code for me to know

last knotBOT
#

@urban anvil

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. You can use !solved to close a post and mark it as solved.

tawdry ivy
#

wow im surprised the bot has that functionality