怎么样给char类型的变量附一个字串值
如:char temp;
  把"this is a sample question"附给temp 3x

解决方案 »

  1.   

    char 只能放一个字符的,你可以用数组,或是指针,
      

  2.   

    应该是用字符串来接受吧?
    char* temp = "this is a sample question";
      

  3.   

    补充:temp为一个数组,
    char temp[256]
    注:不用指针
      

  4.   

    基本概念问题:char是字符,char*是字符的指针或数组,可以用来保存\0结束的字符串。
      

  5.   

    char temp[256];
    strcpy(temp,"this is a test");
      

  6.   

    char temp[256] = " this is a sample question";