1. 程式人生 > >strlen的結束條件

strlen的結束條件

#include <stdio.h>
#include<string.h>
int main(){
	char a[1000];
	int i;
	for(i = 0; i < 1000; ++i){
		a[i] = -1 - i;
	}
	char c[] = {1,1,0,2};
	char d[] = {1,1,1,'\0',2};
	char e[] = {'1','2','0','3','\0'};
	
        printf("%d\n",strlen(c));//2
        printf("%d\n",strlen(d));//3
	printf("%d\n",strlen(e));//4
	printf("%d\n",strlen(a));//255

	return 0;
}