Velocity Reviews - Computer Hardware Reviews

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

Thread Tools

difference between a pointer array and a stack array?

Keith Thompson
Posts: n/a
      05-28-2008 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

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) <>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Reply With Quote

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 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