定义一个字符串指针数组char *p[]={"0:","1:"};如果我想把" * "添加到字符串的末尾,可不可以这样写?如果不能,该咋样?char *p[]={"0:","1:"};strcat(p[0]," * ");
那么如何输出呢?#include <stdio.h>#include <string.h>
void main(void ) { char p[2][5]={"0:","1:"}; strcat(p[0],"*"); printf("%s",p);}这样不能把结果直接打出来,难道要用循环?有没有大虾帮忙看下,能不能直接用地址把这些字符串直接输出来?
#include <stdio.h>#include <string.h>
void main(void ) { char p[2][5]={"0:","1:"}; strcat(p[0],"*"); printf("%s",p[0]); getch();}