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: Anonymous 2013-06-27 14:26

>>39
>ITS POINTERS AIN'T EVEN NUMERS.

010010010110111001110100011001010111001001101110011000010110110001101100011110010010000001101001011101000010011101110011001000000110000101101100011011000010000001101110011101010110110101100010011001010111001001110011001000000010110100100000011000010110110001101100001000000110010101101100011100110110010100100000011010010111001100100000011100110111010101100010011010100110010101100011011101000110100101110110011001010010000001100001011011100110010000100000011000010010000001101101011000010111010001110100011001010111001000100000011011110110011000100000011010010110111001110100011001010111001001110000011100100110010101110100011000010111010001101001011011110110111000101110

Name: Anonymous 2013-06-27 14:26


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