Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > difference between a pointer array and a stack array?

Reply
Thread Tools

difference between a pointer array and a stack array?

 
 
Keith Thompson
Guest
Posts: n/a
 
      05-28-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:
> On May 28, 8:11 pm, Keith Thompson <(E-Mail Removed)> wrote:

[...]
>> str1, in the only example code quoted here, is an array, not a
>> pointer.
>>
>> [...]
>>
>> >> This is why the statement str2 = str1; is legal. str2 has type char*.
>> >> The expression str1 is converted to an expression that has type char*.
>> > No, str1 is a char * (in my example).

>>
>> Then perhaps your example got lost. The sample code, if the
>> attributions are correct was originally posted by Ahmad Humayun; in
>> that code, str1 is declared as an array.
>>
>> [snip]

> My example was right in that [snip].

[...]

So it was.

The article to which I replied did have a declaration of str1 (as an
array), and I missed the other declaration that appeared at the bottom
of that article, after your statement that you had declared it as a
pointer.

Incidentally, the original declaration:

char str1[] = "wxyz";

cannot be a pointer declaration; for it to be one, you'd have to move
it into a function prototype *and* drop the `` = "wxyz";''.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ compilers have one stack for local variables and return addresses and then another stack for array allocations on the stack. Casey Hawthorne C Programming 3 11-01-2009 08:23 PM
Difference between the stack and the heap? Zach C Programming 9 02-20-2007 04:16 AM
[pointers and arrays]: The difference between an array name and a pointer iamchiaweilin@gmail.com C Programming 7 10-02-2006 11:03 PM
What is the difference between dynamic memory allocation,and stack allocation ? chris C++ 6 10-28-2005 05:27 AM
Difference between bin and obj directories and difference between project references and dll references jakk ASP .Net 4 03-22-2005 09:23 PM



Advertisments