Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > come in(I have ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 26085 of 26198
Post > Topic >>

come in(I have a puzzled)

by "Kevin" <yushumao65@[EMAIL PROTECTED] > May 6, 2008 at 06:45 PM

Source:
#include <stdio.h>
#include <ctype.h>
void main()
{
    char a[]="this is the beautiful world!";
    char b[20];
    strcpy(b,a);
    printf("char array b size is(%d),The content of b
is:%s\n",sizeof(b),b);
    if(strcmp(a,b)==0)
       printf("a equal to b!\n");
}

Now , question as follows:

1. Why "b" size unequal "a" size , but "b" can output "a" content?
2. Why "if(strcmp(a,b)==0)" is true?




 8 Posts in Topic:
come in(I have a puzzled)
"Kevin" <yus  2008-05-06 18:45:41 
Re: come in(I have a puzzled)
Richard Heathfield <rj  2008-05-06 11:14:20 
Re: come in(I have a puzzled)
jt@[EMAIL PROTECTED] (Je  2008-05-06 11:11:41 
Re: come in(I have a puzzled)
Bart <bc@[EMAIL PROTEC  2008-05-07 14:18:17 
Re: come in(I have a puzzled)
ReplyDude <alss@[EMAIL  2008-05-07 15:30:47 
Re: come in(I have a puzzled)
Keith Thompson <kst-u@  2008-05-07 14:40:32 
Re: come in(I have a puzzled)
Bart <bc@[EMAIL PROTEC  2008-05-07 15:07:59 
Re: come in(I have a puzzled)
Keith Thompson <kst-u@  2008-05-07 15:43:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 2:27:33 CDT 2008.