对于这样一个指针变量
char *s="hello world";
如何逐个打印其中的每一个字符 比如利用for循环等等
对于这样一个指针变量
char *s="hello world";
如何逐个打印其中的每一个字符 比如利用for循环等等
#include "stdafx.h"
#include "string.h"
#include "stdio.h"
int main(int argc, char* argv[])
{
char *s = "hello world";
int i;
for(i=0;i<strlen(s);i++){
printf("%c",s[i]);
}
return 0;
}