第1个回答 2017-12-25
#include <stdio.h>
int main()
{
char str[]="computer";
char *p;
for(p=str;*p!='\0';p+=2)
printf("%c",*p);
printf("\n");
}
//运行结果
F:\c_work>a.exe
cmue本回答被提问者和网友采纳
第2个回答 2017-12-25
#include <stdio.h>
#include <string.h>
void IntervalStr(char *pStr, int nLen)
{
for(int i = 0; i < nLen; i+=2)
{
printf("%c", pStr[i]);
}
}
int main(int argc, char argv[])
{
char acBuf[16] = "computer";
IntervalStr(acBuf, strlen(acBuf));
return 0;
}
第3个回答 2012-05-18
#include <stdio.h>
#include <string.h>
#define N 100
int main()
{
char a[N] = {0};
char *p= a;
strcpy(p, "computer");
while(*p!= '\0' )
{
printf("%c ", *p);
p++;
}
printf("\n");
return 0;
}
第4个回答 2012-05-18
#include "stdio.h"
void main()
{
char a[100];
char* computer="my string";
strcpy(a,computer);
int i=0;
while(*a!="\0")
printf("%c ", *a++);
printf("\n");
}