C sizeof char* array

后端 未结 3 1781
温柔的废话
温柔的废话 2020-12-14 00:33

I have a char* array as follows:

char *tbl[] = { \"1\", \"2\", \"3\" };

How do I use the sizeof operator to get t

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 01:20

    The shorter and, arguably, cleaner version would look as

    sizeof tbl / sizeof *tbl
    

    :)

提交回复
热议问题