Talk About Network

Google


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 > Re: K&R2 , exer...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 25930 of 27343
Post > Topic >>

Re: K&R2 , exercise 7.6

by arnuld <NoSpam@[EMAIL PROTECTED] > Apr 28, 2008 at 10:33 AM

> On Thu, 24 Apr 2008 06:16:53 +0000, Richard Heathfield wrote:


> Half-right. A string is a contiguous sequence of characters terminated
> by the first null character, whose length is given by the number of
> characters in the string not including the null character. Thus, a
> string with a null as its first character is still a string, but it has
> 0 length.

ah... I think I will better use this for clarity:

  *buf = '\0';

for if I could be reading an array of integers at some other time.


 
> You can do this:
> 
> size_t CalcNumElementsInChar20Array(char (*p)[20]) {
>   return sizeof *p / sizeof (*p)[0];
> }
> }

> but what's the point?


The last sentence is the one I usually ask to the programmers when they
use arrays in C++ for writing Desktop Applications, all the time, or
when they use <void main()> in C.

I think I got your point.




-- 
http://lispmachine.wordpress.com/
my email ID is at the above address
 




 2 Posts in Topic:
Re: K&R2 , exercise 7.6
arnuld <NoSpam@[EMAIL   2008-04-28 10:33:11 
Re: K&R2 , exercise 7.6
santosh <santosh.k83@[  2008-04-28 13:11:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sat Sep 6 21:50:47 CDT 2008.