arshad
u got my point or not?
On Sun, Aug 14, 2011 at 1:16 PM, Arshad Alam alam3...@gmail.com wrote:
program is running smooth but I have one confusion at line number 8.
why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')*
1.#includestdio.h
2.#includeconio.h
3.void
@ Gaurav:
in ASCII code : '\0' is actually 0,
if you are confused with '0' and 0, first one the character and later one is
Remember that '0' is not 0 in ASCII, rather value of '0' is 48.
So they can be used in place of each other.
[ Just expanding what Sagar is trying to say]
On 14 August 2011
program is running smooth but I have one confusion at line number 8.
why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')*
1.#includestdio.h
2.#includeconio.h
3.void main()
4.{
5.clrscr();
6.char s[]=No two viruses;
7.int i=0;
8.while(s[i]!=0)
program is running smooth but I have one confusion at line number 8.
why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')*
1.#includestdio.h
2.#includeconio.h
3.void main()
4.{
5.clrscr();
6.char s[]=No two viruses;
7.int i=0;
8.while(s[i]!=0)
ascii value of '\0' is 0 so they can be used in place of each other
On Sun, Aug 14, 2011 at 10:24 AM, Arshad Alam alam3...@gmail.com wrote:
program is running smooth but I have one confusion at line number 8.
why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')*
1.#includestdio.h
Well, this can have undefined behavior. Technically you should append
- First allocate memory for a string
- Then append the terminating char
In this case, the memory location after the last character is set to
zero, but then you do not have control over it. It may not be zero
when you run it the
gaurav
he is asking why we are using 0 in place of '\0' in line 8
On Sun, Aug 14, 2011 at 10:51 AM, Gaurav Menghani gaurav.mengh...@gmail.com
wrote:
Well, this can have undefined behavior. Technically you should append
- First allocate memory for a string
- Then append the terminating char