0
Please Have a Look at my Binary converter and give me some advice on how to optimise my code. Pointers appreciated. Thanks
6 Respuestas
+ 1
You actually can't do that with an array. They are immutable. You would need to create a new array each time you wanted to change its length.
+ 1
It's dangerous the way you're doing this. You're writing into memory beyond the end of the array and then recalling those bits from memory. While it is working here you may end up overwriting something important when ran on a computer or you may end up receiving some garbage back from accessing the elements beyond the zero index. Instead create the array with an element count that is large enough to hold all integers within the bounds of an integer type.
sizeof(type) * 8
+ 1
Got it. Thanks alot!
+ 1
Thanks dawg. Much appreciated
+ 1
You don't really need them here, but when you do get to where you need something similar to an array, yet resizable, look into the STL at Containers and see vectors and lists etc.
0
I tried to write it in a way that would increment the the array size by one everytime an element is added. Bad method huh