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:
Anonymous2007-04-07 16:34 ID:QGmaw70d
declaration != expression
Name:
Anonymous2007-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.
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:
Anonymous2007-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?
>>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:
Anonymous2007-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.
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.
>>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:
Anonymous2007-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:
Anonymous2007-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:
Anonymous2007-04-09 19:10 ID:W9i0wa3S
>>15
So what you're saying is this is your first and only time? Good.
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