--- In [email protected], Rick <[EMAIL PROTECTED]> wrote: > > if you are using printf(), the output format for octal is %o > > Funny, though. I'd expect sizeof(s) to be 5 not 4. > > in C: > > #include <stdio.h> > #include <stdlib.h> > > int main(int argc, char *argv[]) > { > char *s="\12345s\n"; > printf("sizeof(s) is %d\n",sizeof(s)); > printf("s= 0x%02x (octal %o), 0x%02X (char %c), 0x%02X" \ > "(char %c), 0x%02X (char %c) 0x%02X (octal %o)\n", > s[0], s[0], s[1], s[1], s[2], s[2], s[3], s[3], s[4], s[4]); > > system("PAUSE"); > return 0; > } > ~Rick <snip>
Rick, why do you expect sizeof(s) to be 5? s is a char*, not a char[]. Regards, Nico
