Use the'\0' feature at the end to find the length of the string to achieve strlen;
int len =0;
char str[]="hello";
char*p =str;
while(*p)
{
len++; //计算字符串的长度
p++; //将指针指向字符串的结尾'\0'
}
for(p--;p-str>=0;p--)
puts(p);
Use the'\0' feature at the end to find the length of the string to achieve strlen;
int len =0;
char str[]="hello";
char*p =str;
while(*p)
{
len++; //计算字符串的长度
p++; //将指针指向字符串的结尾'\0'
}
for(p--;p-str>=0;p--)
puts(p);