Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Re: char * vs char[] (http://www.velocityreviews.com/forums/t267721-re-char-vs-char.html)

=?iso-8859-1?Q?Juli=E1n?= Albo 06-25-2003 06:21 PM

Re: char * vs char[]
 
C Wood escribió:

> void some_func() {
> char temp[] = "prepend"; /*This one*/
> char *temp= "prepend"; /*Or this one*/
> strcat(temp," before this");
> }


None of them. char temp []= "prepend"; allocates just the space needed
for the characters of the string plus the zero terminator. If you strcat
to it you are out of space.

Regards.


All times are GMT. The time now is 04:17 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.