c语言如何对字符串变量赋值

如题所述

标准C中没有字符串变量这一说法,其存储字符串是用字符数组。
#include <stdio.h>
#include <string.h>
int main(){
char p[30];

strcpy(p,"hello"); //用这个函数可以给字符数组赋值。

printf("%s",p);

}
温馨提示:答案为网友推荐,仅供参考
相似回答