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

Find the size of pointer in C

Name: Anonymous 2009-06-25 0:32

suppose char *str has some bytes(not malloced), how can i determine the size of *str without access to str itself?

Name: Anonymous 2009-06-25 0:50

~ >cat > test.c
#include <stdio.h>
int main()
{
    char * str = "abc";
    printf("%d\n",sizeof(str));
    return 0;
}
~ >gcc test.c
~ >./a.out
4
~ >

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