> Sorry to bother you! I did post in the comp.lang.c group but thought
> it wouldn't hurt to post here also...excuse me ...it won't happen
Yes, and you can imagine how well the post went over there.
If you are going to post to more than one group, learn how to
crosspost. However, usually you should not be posting to more than one.
Also read the information below.
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
> cj wrote:
> > The textbook is confusing me compared to my workbook. And I am
> > trying, that's why I am so stressed. But hey Mike thanks for
> > taking time to reply! I think I can get help from others that
> > aren't so rude and fyi: I did post in the comp.lang.c group so I'm
> > not all that stupid. Just didn't think it would hurt to post here
> > too but I guess I was wrong.
> I suspect that the C group will be much more grumpy than this one.
> What I did for my first C class was simple: I sat down one weekend
> and read the friggin textbook, from near the beginning until after
> the middle, straight through.
Pretty much what I did. I also took reading notes. That was the most
motivated I ever was for a class, but I was taking it because I really
wanted to learn C, it was my first return to school after several years
out. I still have that book of reading notes.
"cj" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hello! I need some major help! I took this computer programming class
> to learn more about computers. Picked this class because it had a
> section to learn web page design but now I have to complete the section
> about the c language and I have no clue! I'm totally stressing out
> because it is blowing my mind and if I don't complete all the lessons I
> don't receive a certificate of completion. Please someone help me! Here
> are a few questions:
> What is the length returned by the "strlen()" function?
> char dog
> strcpy (dog,"I am a dog");
> strlen (dog);
Since this is kinda like homework I'll make you think a little.
this strlen would return 4.
strcpy(dog, "woof woof");
this strnlen would return 9.
So what do you think
strcpy(dog, "I am a dog");
would return? strlen counts the characters until the first null terminator,
which is simply the value 0. A c-style string is terminated with a 0 byte.
"woof" contains 5 bytes. 'w' 'o' 'o' 'f' '\0'. '\0' is a way of making a
character 0, which can also just be 0.
Thanks to all who replied! Some of the info was very helpful which is
what I was looking for. Thanks again!