c: output interpretation
Hi,
i have written this program -i know it's wrong. However, can somebody interpret the following "unpredictable" -as far as my concerns- output? What is it? Does it enter the "object code area" of the binary? If somebody can clear out with a little bit more detailed info... Thanks Code:
#include <stdio.h> Code:
kaaads |
At first glance, part of the problem is this line:
Quote:
Code:
char s[]="kaaads"; |
in your while loop you are comparing the value of the ptr (a memory address not what is at that address) to the null char (0) so as long as the ptr is pointing at some valid address it will print.
the most common solution Code:
while ((*s)!='\0'); |
> At first glance, part of the problem is this line:
actually that line is ok. its creating a string in the local scope that is pointed to by s.. |
All times are GMT -5. The time now is 09:44 AM. |