The problem I see is that during runtime, The second argument (argv[2]), does not get passed to the init_variables function while the first argument (argv[1]) does. I checked this using VS2010 debugger. I can see during execution that the value of argv[2] is read correctly though.
Can anyone tell me a reason why this might be happening??
I solved the problem (a small quick-fix) by converting the argument to strings, as in the following
Well, In my opinion, the problem exists because I can see it during runtime when I check the values :).
By solving I meant, I manged a quick-fix, to move ahead. I also mention what my quick-fix was, so that people who have an idea about this, might be able to compare and tell me what exactly is the difference.
Thanks for the effort... let me tell you, ridiculous as this sounds! (I'd be as unbelieving as you are).. but I am extremely confused here, and it'd help a lot if someone could tell me what could be the problem here
but please do take a look at the following two screen shots
I agree your code totally works, and the values do get passed into init variables... and here is a screen shot of the runtime value
I do not open uknown references.
So show the code where you comment the output statement and what is wrong with this. Because the function contains only this output statement. I do not understand what you are awaiting.
Could it be because of optimizations done by the compiler? Maybe the compiler sees that the parameters will never be used inside the function so it just don't initialize the parameters.
Peter, thanks for bringing up a very logical point... now that is very possible, since I have not yet completed that part of the code that uses the second argument. I will do that and see if that solves the issue, and let you know!
The behavior was indeed due to compiler optimization! In fact I saw a lot more cases where VS2010 optimization in fact made it difficult for me to do a runtime debugging and so had to disable optimization!