c语言中显示字符串数组的长度(数组实现的字符串数组和指针实现的字符串数组)
1、
#include <stdio.h> int main(void) { char x[][128] = {"aaa","bb","cccccc","d","eee"}; char *y[] = {"11111","22222222","3333"}; printf("length of x: %u\n", sizeof(x)/sizeof(x[0])); printf("length of y: %u\n", sizeof(y)/sizeof(y[0])); return 0; }