110,533
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <windows.h>
int strlen(char* p)
{
int n=0;
while(*(p++)!='\0')
n++;
return n;
}
int main()
{
int i=0;
char path[260];
char winDir[260];
GetSystemDirectoryA(path,260);
GetWindowsDirectoryA(winDir,260);
printf("%d\n",strlen(path));
printf("%d\n",strlen(winDir));
printf("%s\n",path);
printf("%s\n",winDir);
getchar();
}
#include<stdio.h>
int strlen(char *p)
{
int len=0;
while(*p!='\0')
{
p++;
len++;
}
return len;
}
void main()
{
char str[20];
scanf("%s",str);
int len=0;
len=strlen(str);
printf("the length of string is %d\n",len);
}
#include<stdio.h>
int strlen (char *p)
{
int i=0;
for(;*p;i++,p++);
return i ;
}
void main()
{
char str[20] ;
scanf("%s",str);
printf("length of str=%d",strlen(str));
}