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

Pointers in C

Name: Anonymous 2013-06-25 17:59

Hey guys I'm having a little trouble with the following example

#include <stdio.h>
int main(void)
{
char s[] = "Melbourne City";
printf("%s\n", &s[2]);
return 0;
}

which prints "lbourne City" instead of the address of letter 'l'.
I do understand that the %s in the printf continues until a null terminator is hit, but not why &s[2] returns a character in the first place.
Thanks.

Name: Lambda Arthur Calculus !!wKyoNUUHDOmjW7I 2013-06-28 20:15

>>72
I LIKE IT.

>>76
var is a global variable called by id from main()
DA IDENTIFIER var HAS FILE SCOPE AND EXTERNAL LINKAGE, AND DA OBJECT IT REFERS TO HAS STATIC STORAGE DURATION. AND IT'S REFERENCED, NOT CALLED, YA RETOID. EEEEEH EEEEEEEEH EEEEEEEEEH EEEEEEEEEEEEEEH! ASIDE FROM DAT IT SEEMS LIKE U'VE ACTUALLY RED DA FUCKIN STANDARD.

>>78
the storage format is the same for int and unsigned int, it merely depends on the interpretation whether the contents are considered unsigned or two's complement signed
UR RIGHT DAT A POSITIVE, SIGNED INTEGER WILL HAVE DA SAME REPRESENTATION OF AN UNSIGNED INTEGER WITH DA SAME SIZE, BUT DATS A PRETTY CRAPPY WAY 2 SAY IT. YAINT GUARANTEED TWO'S COMPLEMENT.

the expression (int)sizeof(arr) would return a negative value - however, the %u specifier in the string literal would recast it to unsigned int anyway.
NOW DATS A LOAD OF SHIT. IF 'sizeof arr' YIELDS A VALUE DAT CAN'T BE REPRESENTED BY int, DA RESULT WILL BE IMPLEMENTATION-DEFINED. UR CONFUSING signed->unsigned WITH unsigned->signed. DA RESULT OF DA FORMER IS DEFINED AND DA RESULT OF DA LATTER IS IMPLEMENTATION-DEFINED. FURTHERMORE, sizeof DON'T HAVE A FUCKIN RETURN VALUE YA RETOID.

Name: Anonymous 2013-06-28 22:32

Name: L. A. Calculus !!wKyoNUUHDOmjW7I 2013-06-29 3:11

>>82
WAT DA FUK IS UR PROBLEM? I DONT LOOK LIKE DAT GUY, I LOOK LIKE GUY STEELE, YA RETOID.

Name: Anonymous 2013-06-29 18:24

>>83
It's not about looks - the "Y U NO"-Guy depicted in that image is an embodiment of the frustration and anger with an individual or group neglecting to do something considered more or less essential in the given situation - in this case, neglecting to read da fuckin Standard.

Name: Anonymous 2013-06-29 20:37

>>84
LLELELLEL EGIN MEME ANALYSIS GRO

Name: Anonymous 2013-06-29 22:32

>>85
meme analysis triggered by meme comprehension fail

Name: L. A. Calculus !!wKyoNUUHDOmjW7I 2013-06-30 1:31

IMAGES R FOR DA WEAK, YA RETOID. U SHUD USE TEXT ONLY BECUZ DAT IS DA UNIVERSAL INTERFACE.

Name: Anonymous 2013-06-30 2:34

Name: Anonymous 2013-06-30 15:23

>>88
I will NOT dereference that pointer you provided there.

Name: Anonymous 2013-06-30 15:45

>>89
Just wait, it's a pointer to a pointer.

Name: Anonymous 2013-07-01 20:40

Name: Anonymous 2013-07-01 20:46

Name: Anonymous 2013-07-01 20:51

Name: Anonymous 2013-07-01 20:56

Name: Anonymous 2013-07-02 0:20

Name: Anonymous 2013-07-02 0:25

Name: Anonymous 2013-07-02 0:30

Name: Anonymous 2013-07-02 17:11

spambegone

Name: Anonymous 2013-07-02 17:11

spambegone

Name: Anonymous 2013-07-02 17:11

spambegone

Name: Anonymous 2013-07-02 17:11

spambegone

Name: Anonymous 2013-07-02 17:12

spambegone

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