I am a new user to Codeblocks and beginning to learn C; I have this problem since the beginning
Whenever i have array with more then 10 elements and while i try to iniatilize the element value to 0 using a loop; after 10th element all the array element fills with random value. I have attached the snapshot for reference.
Any suggestion would be appreciated :)
Edit: Most debuggers and likely CB does the same shows the value before the line in debugger is executed!
I suggest doing a break point after the line.
Read the Rules and the FAQs.
http://forums.next.codeblocks.org/index.php/topic,9996.0.html (http://forums.next.codeblocks.org/index.php/topic,9996.0.html)
http://wiki.codeblocks.org/index.php?title=FAQ (http://wiki.codeblocks.org/index.php?title=FAQ)
Edit2: Post a build log and your code on a site that teaches how to program.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
Tim S.
Please read the debugger info it might help.
Edit: Sorry, I misread your question; did NOT realize it was on how to use the debugger instead of on how to code.
http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks (http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks)
Tim S.
I am using codeblocks in windows 8. I have a doubt that if there is some tweak/setting/config i have to adjust in codeblock.
somehow array longer then 10 element is not being initialized.
How could debugger have something to do with it ???
This is a bug in the debugger plugin.
Do you see the first line in your watches windows - 0 <repeats 11 times>?
This means that the debugger is trying to be smart and tells us that this array has 11 zeroes at the first 11 elements.
Its not the debugger which is initializing the array values to 0
For Loop in the code is initializing value of 0 in each and every elements in the array but when for loop reached 10th element all the array values goes back to random values.
The problem is; I can't initialize array elements value to 0.
I think you're wrong here.
One easy way to find out is to add another loop after your initialization loop that will print the values of the array on the screen.
He's being misled by it saying counts[0] is a series of 11 zeroes and that counts[1] is a nonzero value. If the bug that oBFusCATed mentioned is that it should instead read that counts[0] is 0 repeated 11 times and that counts[11] is nonzero, that would seem to be the cause for confusion.
It was just my confustion
Array was initialized properly and debugger was saying 11 times 0 :)
Thank You Very Much oBFusCATed and raynebc :D