How to find the length of an char array in c

后端 未结 6 1137
野性不改
野性不改 2021-02-06 12:06

I want to find the length of this :

char *s[]={\"s\",\"a\",\"b\"};

it should count 4 with the /0 but the strlen or sizeof(s)/sizeof(char) gives

6条回答
  •  囚心锁ツ
    2021-02-06 12:48

    Why should it count 4? you have 3 pointers to char in this array, it should count 12 on most 32-bit platforms.

提交回复
热议问题