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: L. A. Calculus !!wKyoNUUHDOmjW7I 2013-06-27 14:54

>>50
I understand you're referring to post-ANSI C standards, such as C90, C99, C11 etc.
UR DED RONG ABOUT DAT. FIRSTLY, ALL DOSE STANDARDS HAVE BEEN ADOPTED BY ANSI. DA ONLY DIFFERENCE IS DAT ANSI DIDNT FUCKIN PUBLISH 'EM. AND C89'S SHIT IN ITS OWN WAYS. MY FAVOURITE C'S A C DAT HAS NO FUCKIN NAME.

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