//写一个函数,求一个字符串的长度,在main函数中输入字符串,并输出其长度#include <stdio.h>#include <string.h>int fun(char *p1){int sum=0;while(*p1!=\'\\0\'){sum++;p1++;}return (sum);}int main(){char str[30]={};char *p;int n;printf(\"请输入一串字符串:\");gets(str);p=str;n=fun(p);printf(\"\\n该字符串的长度为:%d\\n\",n);return 0;}

爱站程序员基地
![[翻译] Backpressure explained — the resisted flow of data through software-爱站程序员基地](https://aiznh.com/wp-content/uploads/2021/05/3-220x150.jpeg)

