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: strcpy ques...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 15 of 17 Topic 26073 of 26959
Post > Topic >>

Re: strcpy question

by Keith Thompson <kst-u@[EMAIL PROTECTED] > May 5, 2008 at 06:00 PM

mdh <mdeh@[EMAIL PROTECTED]
> writes:
> On May 5, 4:23 pm, Keith Thompson <ks...@[EMAIL PROTECTED]
> wrote:
>  >....... Any such expression will be converted to a
>> pointer, and the called function has absolutely no way of knowing
>> whether such a conversion has happened. ....
>
> Thanks Keith...that's what I thought, but just wanted to be sure.
> In C, is it quite common to pass a pointer to which one has allocated
> an array, as K&R do in this example?

Yes, it's extremely common; it's how arrays are usually dealt with in
C.

You also usually need some way to specify how big the array is, or how
big the ****tion you're interested in is.  For strings, this is
generally determined by the position of the '\0' terminator.  For
other arrays, it's common to pass a second argument that specifies the
length of the array (see, for example, the third parameter of
memcpy()).

-- 
Keith Thompson (The_Other_Keith) <kst-u@[EMAIL PROTECTED]
>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
 




 17 Posts in Topic:
strcpy question
mdh <mdeh@[EMAIL PROTE  2008-05-05 11:19:59 
Re: strcpy question
Eric Sosman <Eric.Sosm  2008-05-05 14:39:35 
Re: strcpy question
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-05 11:39:39 
Re: strcpy question
David Thompson <dave.t  2008-05-19 03:59:51 
Re: strcpy question
Keith Thompson <kst-u@  2008-05-18 21:39:15 
Re: strcpy question
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-05 11:41:33 
Re: strcpy question
"Default User"   2008-05-05 18:47:03 
Re: strcpy question
mdh <mdeh@[EMAIL PROTE  2008-05-05 13:08:56 
Re: strcpy question
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-05 14:34:55 
Re: strcpy question
mdh <mdeh@[EMAIL PROTE  2008-05-05 16:04:37 
Re: strcpy question
"Default User"   2008-05-05 23:16:18 
Re: strcpy question
Keith Thompson <kst-u@  2008-05-05 16:23:24 
Re: strcpy question
mdh <mdeh@[EMAIL PROTE  2008-05-05 16:07:12 
Re: strcpy question
mdh <mdeh@[EMAIL PROTE  2008-05-05 16:52:00 
Re: strcpy question
Keith Thompson <kst-u@  2008-05-05 18:00:22 
Re: strcpy question
mdh <mdeh@[EMAIL PROTE  2008-05-05 16:52:33 
Re: strcpy question
mdh <mdeh@[EMAIL PROTE  2008-05-05 18:17:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Thu Jul 24 16:07:13 CDT 2008.