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

POINTERS, STACK, CODESPACE, ETC

Name: Anonymous 2008-05-25 17:58

http://i30.tinypic.com/2z5itg5.jpg

Read and enjoy the lesson

Name: FULLFORCE 2008-05-25 18:00

Proper English, nigger, do you know it?

Name: Anonymous 2008-05-25 18:26

>>1
you know it's a pointer because of the star before the name
Orly?
Is char *array[123]; a pointer too? (hint: it's an array)
When you make a pointer, you basically make a variable that holds an address instead of a value.
An address is a value. You don't "make" pointers or variables.
You define them.
Another way to declare an array is something like
char s[]

You cannot define an incomplete object, such as char s[];
And you don't declare arrays, you define them.
Learn the difference between declare and define.
The difference is that here, the array is on the stack.
Actually, C doesn't have "stacks", nor "heaps".
(like an 'if', 'while' function, etc)
if and while are keywords, not functions.
Your last snippet, in particular:

int main(void) {
char s[1024];
main();
return (0);
}

Invokes undefined behavior, it doesn't "overflow" the stack.
In particular, see 5.2.4.1 Translation limits.
Plus, a compiler is free to ignore the unused object 's', and the never reached return, and optimize right away to an infinite loop.

And that's my lesson for you today.

Name: Anonymous 2008-05-25 18:37

>>3
my god you're a retarded little nigger, eh?

1.  char *array[123] IS a pointer.  It points to the head of an array of strings.

2.  Define and make are interchangeable terminology.

3.  GODDAMN, you don't know what the 'stack' and 'heap' are in memory hierarchy??  fucking just kill yourself now.

Name: Anonymous 2008-05-25 18:43

>>1
Back to /b/ please

Name: Anonymous 2008-05-25 18:44

>>4
1.  char *array[123] IS a pointer.  It points to the head of an array of strings.
No, char *array[123] is an array of 123 pointers to char.
A pointer to an aray of 123 char would be char (*array)[123]
2.  Define and make are interchangeable terminology.
Not according to the standard.
3.  GODDAMN, you don't know what the 'stack' and 'heap' are in memory hierarchy??  fucking just kill yourself now.
They don't exist in the standard.

Name: FULLFORCE 2008-05-25 18:46

TROLL DETECTED.

Name: Anonymous 2008-05-25 19:00

DETECTOR TROLLED.

Name: Anonymous 2008-05-25 19:05

OBSERVER SAGED.

Name: Anonymous 2008-05-25 19:08

DETECTOR DETECTED

Name: Anonymous 2008-05-25 19:10

SAGE OBSERVED

Name: Anonymous 2008-05-25 19:20

DEVRESBO EGAS

Name: Anonymous 2008-05-25 19:24

>>6
A char pointer is basically a string
A char array is basically a char pointer


int main(int argc, char *argv[]) {
  int i = 0;
  while (i<argc)
    printf("%s\n", argv[i++]);
  return(0);
}


You're correct, the mem stack/heap aren't in the standard, but they ARE standard to x86 architecture, which is what most of us program on, and probably what you're using to post.  GTFO

Name: Anonymous 2008-05-25 19:32

It's a great explanation, you know because I say fuck in every second sentence.

Name: Anonymous 2008-05-25 19:55

The fact that this is an image and speaks like /b/ makes me think that this is from a /pr/. /pr/ nomads.

Name: Anonymous 2008-05-25 20:13

Hah.  >>3,6 owned >>4 like the little nublet he is.

well done, anon.

Name: Anonymous 2008-05-25 20:51

>>13
Posting from the Sun

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