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

Pages: 1-

question about C arrays

Name: Anonymous 2007-04-07 16:32 ID:LoSQZFDz

Well, taking that this is true:

char buffer[] = "test";
buffer[1] == 1[buffer]; // ('e' == 'e')

I suppose that when you use [] it's like writting
buffer[1] == *(buffer+1);
so.. why i can't declare an array like

char *(buffer+10);
?

Name: Anonymous 2007-04-07 16:34 ID:QGmaw70d

declaration != expression

Name: Anonymous 2007-04-07 17:20 ID:fRV4Qxh7

(buffer+10) gets the address of buffer, and increments it by 10*sizeof(char) bytes, resulting in a pointer to the 11th element of buffer (buffer[10]).  The * dereferences the pointer, giving you the value in the 11th element.

Name: Anonymous 2007-04-07 17:23 ID:Heaven

fuck off and read your c book you worthless shit

Name: Anonymous 2007-04-08 1:36 ID:1pDhtZnS

Array access is synonymous with, if not identical to, pointer access. These are interchangeable.

Array declaration and pointer declaration are two different things. The latter gives you a pointer and only a pointer. The former gives you a pointer, a contiguous block of memory to play with (in the stack,) AND points the pointer to the memory block. These are not interchangeable.

Name: Anonymous 2007-04-08 7:33 ID:zsK8AiBx

>>5 thanks now i understand
>>4 well if everyone read his books and references why is there a /prog/ and so many programming communities?

Name: Anonymous 2007-04-08 11:19 ID:Heaven

>>6
For obscure questions that are not in textbooks. Not stupid shit you read on page 2 of every C book in existence.

Name: Anonymous 2007-04-09 1:19 ID:W9i0wa3S

buy more ram

Name: Anonymous 2007-04-09 4:49 ID:Heaven

>>7
And for trolling.

Name: Anonymous 2007-04-09 5:29 ID:e6k1G+U3

>>7
Because it's so efficient to search through a book and maybe find your answer than it is to ask someone a question and have them explain the answer to you.

Also, you can totally ask a book to clarify stuff for you.

gb2/bed/, Hal.

Name: Anonymous 2007-04-09 5:35 ID:Ds8hGTWf

>>10
This issue is so elementary that if it needs any clarification beyond the description in any half-decent textbook, you would not get it, no matter how many people try to clarify it to you.

Name: Anonymous 2007-04-09 7:51 ID:XIoPxfh9

>>10

Saving 15 seconds of newbie idiot programmers' time isn't worth losing 15 minutes of productivity from the senior dev who had to interrupt their train of thought to answer the idiot question.

lrn2read

Name: Anonymous 2007-04-09 8:52 ID:Heaven

>>12
Then why you bothered posting in this thread you EXPERT PROGRAMMER?
If you are in deep thoughts you DON'T visit a forum/bbs/whatever, and especially a chan.

Name: Anonymous 2007-04-09 11:35 ID:nzkAielY

>>10
Dude, this is not the sort of thing you need to look up, it's the sort of thing you should ALREADY KNOW.

Quit trying to fucking redeem yourself. You asked a STUPID fucking question, and you deserve the shitstorm you're getting. Quit while you're behind and shut the fuck up.

Name: Anonymous 2007-04-09 14:14 ID:eLEbNM3X

>>14
>>10 is not the OP, i know because i am the OP
Also, in this thread everyone has asked even once in his life something that is written in the chapter he skipped etc.

Name: Anonymous 2007-04-09 19:10 ID:W9i0wa3S

>>15
So what you're saying is this is your first and only time? Good.

Name: Anonymous 2007-04-09 21:28 ID:9Iz3vmM1

>>15
dont skip chapters then.

fuck. learn some cobal. no way in hell can you "skip" chapters when learning that shit.

Name: Anonymous 2007-04-10 1:11 ID:NDyAPtmI

>>17
Apparently you can still skip the very name of the language.

Name: Anonymous 2007-04-10 4:41 ID:XQWxLOYH

>>18
who wants to remember it?! :S

Name: Anonymous 2009-01-14 13:14

SICP

Name: Anonymous 2009-01-14 13:15

GO BACK TO A FAG LANGUAGE NOOB

Name: Anonymous 2011-02-03 4:37

Name: Sgt.Kabu䅤鄗kiman也웁 2012-05-29 0:03

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

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