Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C Question

Name: Anonymous 2011-07-19 2:02

Im going to be taking Intro to C in the fall so I have decided to read up on the textbook and learn how to program before the semester starts. I'm having a little problem, here's the trouble maker:
    potr1 = &goodarray[0];

    potr2 = &goodarray;

for some reason potr2 gets assigned the value of the &goodarray[0]instead of the &goodarray itself.. I have verified this by printfing both of them and they come up the same number. Im using DevC++ and Im pretty sure I just need to find a better compiler, but am I doing something wrong?

Name: Anonymous 2011-07-21 0:02

>>26
How's that?  Please explain how
The name of an array evaluates to a pointer to the first element of the array
is not true.

Since you referred me to 5.3 in K&R2, I will quote it for you:
Since the name of an array is a synonym for the location of the initial element, the assignment pa=&a[0] can also be written as

pa = a;

ERGO YOUR WRONG BICTH and IHBT by a tripfag :(

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List