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:
Anonymous2011-07-19 2:40
>>1
What are you trying to do exactly? What datatype are those variables?
>>6 The name of an array evaluates to a pointer to the first element of the array, as >>3,4 pointed out.
That's a big no you dumbass. The person that gave the response never said that. You just incorrectly assumed it. For further clarification, please refer to section 5.3 in the second edition of "The C Programming Language" by K & R.
>>23
That >>6 doesn't understand the relationship between a pointer and an array in C.
Name:
Anonymous2011-07-20 23:11
arrays and pointers differ in size
Name:
Anonymous2011-07-20 23:32
Im going to be taking it up the ass in the fall so I have decided to read up on the textbook and learn how to anus-spread before the semester starts. I'm having a little problem, here's the trouble maker:
finger1 = &anus[0];
finger2 = &anus;
for some reason finger2 gets inserted with the value of the &anus[0]instead of the &anus itself.. I have verified this by inserting both of them and they come up the same rectal wall. Im using AstroGlide++ and Im pretty sure I just need to find a better partner, but am I doing something wrong?
>>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
Also you stupid shit, pa if of type int * as opposed to something like say int[10].
Name:
tourettes syndrome2011-07-21 1:43
>>30,31 Would foo evaluate to a pointer to the first element of this array?
Um... Why, yes, it would.
Am I alone in thinking this guy is insane? Holy moley.
I'm not sure what your deal is, besides being autismal as fuck, so I will just leave you with this: http://codepad.org/z3aQna6H
Name:
Anonymous2011-07-21 2:03
>29-32 The name of an array evaluates to a pointer to the first element of the array
Technically, the name of the array evaluates to pointer to an array which has the same value as the pointer to its first element. It has the same value but it's of a different type. In this case foo == &foo but sizeof(foo) != sizeof(&foo). Matters when doing memcpys and shit.
This whole shit about ``the name of an array'' is _still_ irrelevant to this discussion in particular, and, furthermore, to _any_ C-related discussion in general.
Get over it.