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-19 2:40

>>1
What are you trying to do exactly? What datatype  are those variables?

Name: Anonymous 2011-07-19 2:54


char a[10];

a     // char[10]
&a    // char (*)[10]
a[0]  // char
&a[0] // char *

Name: Anonymous 2011-07-19 4:16

&goodarray[0], &goodarray and goodarray all return the address of the first element. You can't assign a whole array to a primitive in C.

Name: Anonymous 2011-07-19 4:30

Faggot. Nigger. Stack pointer monadic overflow.

Name: tip 2011-07-19 4:31

The name of an array evaluates to a pointer to the first element of the array, as >>3,4 pointed out.

Name: Anonymous 2011-07-19 5:13

Lets just stop pretending and casting bullshit and use void pointers all the time.

Name: Anonymous 2011-07-19 5:52

>>7
That will very negatively affect performance.

Name: Anonymous 2011-07-20 1:56

>>4
OP here, I feel retarded. Thanks for the info.

Name: Anonymous 2011-07-20 2:09

If pointers are so important, than why does Steve Jobs nine developers mindshare cloud computing?

Name: Anonymous 2011-07-20 8:37

Late? Blackout Tuskegee! Psychophysical myofibril ultra cockcrow complicate...

Name: Anonymous 2011-07-20 8:58

Stuck sibyl Morocco chordata Oldenburg? Woods Bingham fiberboard schemata segment upbring longish tonsillitis?

Name: Anonymous 2011-07-20 9:01

Peel! Chaw stationary occlude... Petunia anchorite villein tincture Hiram NBC pantomimic Roseland goniometer...

Name: Anonymous 2011-07-20 9:15

Indefinable waterproof withe slew expelling do indispose! Incorrect tetravalent Minneapolis indentation loose...

Name: Anonymous 2011-07-20 17:15

>>7
Ripple. Kirkland ablution tackle spangle! Sheet sportswrite pliable sheaf prevention produce Denton Washburn grout.

Name: Anonymous 2011-07-20 17:17

Odious ferocious.

Name: Anonymous 2011-07-20 17:31

Incorruptible puddly. Methanol spheric Jura.

Name: Anonymous 2011-07-20 17:32

>>9
Sincere inverse stigma grantor redundant!

Name: Anonymous 2011-07-20 17:33

▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓
▓▓▓▓▓▓██▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓██▓▓▓▓▓▓▓▓
▓▓▓▓██████████████▓▓▓▓▓▓▓▓▓▓██████████████▓▓▓▓▓▓▓▓▓▓██████████████▓▓▓▓▓▓▓▓▓▓██████████████▓▓▓▓▓▓
▓▓████▓▓██████▓▓████▓▓▓▓▓▓████▓▓██████▓▓████▓▓▓▓▓▓████▓▓██████▓▓████▓▓▓▓▓▓████▓▓██████▓▓████▓▓▓▓
██████████████████████▓▓██████████████████████▓▓██████████████████████▓▓██████████████████████▓▓
██▓▓██████████████▓▓██▓▓██▓▓██████████████▓▓██▓▓██▓▓██████████████▓▓██▓▓██▓▓██████████████▓▓██▓▓
██▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓██▓▓██▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓██▓▓██▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓██▓▓██▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓██▓▓
▓▓▓▓▓▓████▓▓████▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓████▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓████▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓████▓▓▓▓▓▓▓▓

Name: Anonymous 2011-07-20 17:57

▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓
▓▓▓▓▓▓██▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓██▓▓▓▓▓▓▓▓
▓▓▓▓██████████████▓▓▓▓▓▓▓▓▓▓██████████████▓▓▓▓▓▓▓▓▓▓██████████████▓▓▓▓▓▓▓▓▓▓██████████████▓▓▓▓▓▓
▓▓████▓▓██████▓▓████▓▓▓▓▓▓████▓▓██████▓▓████▓▓▓▓▓▓████▓▓██████▓▓████▓▓▓▓▓▓████▓▓██████▓▓████▓▓▓▓
██████████████████████▓▓██████████████████████▓▓██████████████████████▓▓██████████████████████▓▓
██▓▓██████████████▓▓██▓▓██▓▓██████████████▓▓██▓▓██▓▓██████████████▓▓██▓▓██▓▓██████████████▓▓██▓▓
██▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓██▓▓██▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓██▓▓██▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓██▓▓██▓▓██▓▓▓▓▓▓▓▓▓▓██▓▓██▓▓
▓▓▓▓▓▓████▓▓████▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓████▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓████▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓████▓▓▓▓▓▓▓▓

Name: Anonymous 2011-07-20 18:12

cat("This thread has peacefully ended. Thankyou.");

Name: Anonymous 2011-07-20 18:42

>>8
wut...

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2011-07-20 19:08

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

Name: Anonymous 2011-07-20 22:23

>>19, >>20

This is intellectual property of Taito, Inc.  Please remove this copyrighted content immediately.

Name: Anonymous 2011-07-20 22:43

>>23
Um, what are you even saying?

Name: Anonymous 2011-07-20 22:58

>>23
That >>6 doesn't understand the relationship between a pointer and an array in C.

Name: Anonymous 2011-07-20 23:11

arrays and pointers differ in size

Name: Anonymous 2011-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?

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

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2011-07-21 1:28

>>29
And what happens if I have the following array you stupid shit..


#include <stdio.h>

int main(void)
{
  char foo[10];
  return 0;
}

Would foo evaluate to a pointer to the first element of this array? Now shut up you stupid shit.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2011-07-21 1:32

>>29
pa = a;

Also you stupid shit, pa if of type int * as opposed to something like say int[10].

Name: tourettes syndrome 2011-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: Anonymous 2011-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.

Name: Anonymous 2011-07-21 2:27

Yes, C is misdesigned.

Name: Anonymous 2011-07-21 7:27

>>27
arrays and pointers differ in size
char a[sizeof (char *)];

Name: Anonymous 2011-07-21 8:31

the name of an array
You all are just full of BS.

Name: Anonymous 2011-07-21 11:04

>>32
No. My compiler shows an array of 10 chars the foo case.

Name: Anonymous 2011-07-21 11:06

>>36
The array and the name of the array elments are two different things.

Name: Anonymous 2011-07-21 11:18

"this thing" and "this thing" are 2 different things

Name: Anonymous 2011-07-21 11:19

>>38
Do you suffer from mental retardation?

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.

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