#include <stdio.h> int main() { int arr[] = { 22, 34, 3, 32, 82, 55, 89, 50, 37, 5, 64, 35, 9, 70 }; int len = (int) sizeof(arr) / sizeof(*arr); printf("数组长度:%d=%d/%d\n",len,sizeof(arr),sizeof(*arr)); getchar(); }
字符型数组长度:strlen(数组名)
2024-01-28 09:45:28
#include <stdio.h> int main() { int arr[] = { 22, 34, 3, 32, 82, 55, 89, 50, 37, 5, 64, 35, 9, 70 }; int len = (int) sizeof(arr) / sizeof(*arr); printf("数组长度:%d=%d/%d\n",len,sizeof(arr),sizeof(*arr)); getchar(); }
字符型数组长度:strlen(数组名)