If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Help with C simple loop.

What if svrList points to a string that is more than 512 bytes? What if I pass a NULL to getServer()? Your code is now broken.

Code:

//return "0";

What is returned if the code falls through to this line that you commented out? The return value is now undefined.

Regards,

Paul McKenzie

As far as the more than 512 bytes, for what I am doing in this program and knowing that arrays cannot be dynamic in nature for 'C', I think my best bet is to just control the data that is in that array to make sure that a NULL or more than 512 bytes are not fed into the function. I know this is not the best way, but for this assignment, it will get me by.

Sorry about that, I changed it to return NULL; and changed my if statement below that.
As of right now, everything is working and the debugger helped a great deal! The only issue I am having now is:

I can't get this loop to break when I enter "N" at the prompt. It seems to completely skip the if true and false values and just continue running the while(1) loop. Am I missing something simple? I am just trying to continue the loop until the user enters anything other than Y or y. In the debugger, the value is getting put in "cont", but it just skips the continue or break on that if statement.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.