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 use !howto ask.
32 messages · Page 1 of 1 (latest)
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 use !howto ask.
int arr[] = {};
that doesnt work
Delete them as in set them all to zero?
I don’t think you can uninitialize memory. Best you could maybe do is free the array if it’s allocated on the heap
Why are you trying to do this anyways?
I'm creating snake in C, I have to draw on the screen the table where the snake and the food are located; to do this I check the Y coordinate of each single piece of the snake/food and if it corresponds to the number of the line I am drawing I write its X in that array to then know where to draw it on that line
the problem is that since i cant delete the contents of the array i always draw everything in the same X
.
Couldn’t you overwrite all the previous value in the array for your next draw cycle?
yeah imma try it
maybe il set every value to something like 99 and not draw anything if its equal to if
Why would you do that when you can overwrite the old values? Pass a length variable around too so you don’t go past what x values you wrote in that cycle
Also why can’t you go directly from an x and y to a point drawn on the screen? Wouldn’t that make this algorithm much more efficient and avoid this array stuff?
i prob fucked up
im making some progress rn, i think i can finish this in a couple of days
memset to zero?
He doesn’t want it to just be zero
do you know if i can make an array bigger after i already made it?
like if a make an array : numbers[2] but then i want to put 3 numbers there
Normal array is fixed size, that's not possible. If you want to change the size of a container in runtime you can use std::vector iirc.
i think i may have found the problem
i had some nested for loops and i wrote [j] instead of [i] for an array
if that isnt whats worng im switching to something else cuz its making me wanna trow my pc out of the window
I, nor anyone else, know exactly what you are doing and what errors you are facing since you didn't include your code (the relevant part of it) in the post 
idk how to🥲 cuz its too long
also the comments and variable names arent in english so it would probably be hard to understand
Break it down to bits: specify what you think is going wrong in your code, what was your intention behind asking your original question, find where you think your problem is, or where it's likely to be at and include it here.
Seems like a XY problem.
yes