User forums > General (but related to Code::Blocks)

array elements fills with random value after 10th element codeblocks 13.12

(1/2) > >>

meyumraaj:
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 :)

stahta01:
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.codeblocks.org/index.php/topic,9996.0.html
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

Tim S.

stahta01:
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

Tim S.

meyumraaj:
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 ???

oBFusCATed:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version