代码
使用指针来遍历字符串,直到遇到字符串结尾的空字符\0为止,统计字符数量即为字符串长度。 
#include<stdio.h>
#define n 20
int getlength(char *a) {
	int len = 0;
	while(*a!='\0'){
		len++;
		a++;
	}
	return len;
}
int main() {
	char *arr[n] = { 0 };
	int len;
	printf("please input the string:\n");
	scanf("%s", arr);
	len=getlength(arr);
	printf("the length of the string is:%d", len);
	return 0;
} 
测试结果






![[NISACTF 2022]join-us - 报错注入无列名注入](https://img-blog.csdnimg.cn/f250de7824494bfebf962d7d8c67ab8f.png)













