| Programming > C > Re: K&R2 , exer... |
|
| << 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:
|
arnuld <NoSpam@[EMAIL |
2008-04-28 10:33:11 |
|
santosh <santosh.k83@[ |
2008-04-28 13:11:52 |
|
Post A Reply:

|