您的位置:

赋值错误c语言,c语言赋值失败

本文目录一览:

c语言编程 赋值错误

scanf函数要求输入时与双引号内的格式完全一致,例如你写的

scanf("%d,%d,%d,%d",a,b,c,d);

输入时就应该写

1,2,3,4

这样的(注意逗号要用英文的逗号)

C语言 关于赋值错误的问题

if((a=b)((b-a+1)=N)(((a+b)*(b-a+1))/2=M))

这句语句错了,我不知道你是不是想写成(((a+b)*(b-a+1))/2==M)(=变成==)

这个的错误是,等号前面是表达式,表达式的结果是一个临时变量,你把M赋值给一个临时变量,肯定错了。临时变量不能做左值

要不改成==,表示相等,如果就是赋值,把M写前面就可以了,把运算的值赋给M

C语言结构赋值报错。

您好哦,这样的:

main(void)

{

struct convert

{

double C[3][3];

};

struct convert con[24]=

{

{1,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0},

{0.0,0.0,-1.0,0.0,-1.0,0.0,-1.0,0.0,0.0},

{0.0,0.0,-1.0,0.0,1.0,0.0,1.0,0.0,0.0},

{-1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,-1.0},

{0.0,0.0,1.0,0.0,1.0,0.0,-1.0,0.0,0.0},

{1.0,0.0,0.0,0.0,0.0,-1.0,0.0,1.0,0.0},

{1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,-1.0},

{1.0,0.0,0.0,0.0,0.0,1.0,0.0,-1.0,0.0},

{0.0,-1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0},

{-1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,1.0},

{0.0,1.0,0.0,-1.0,0.0,0.0,0.0,0.0,1.0},

{0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0},

{0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0},

{0.0,0.0,-1.0,-1.0,0.0,0.0,0.0,1.0,0.0},

{0.0,-1.0,0.0,0.0,0.0,1.0,-1.0,0.0,0.0},

{0.0,1.0,0.0,0.0,0.0,-1.0,-1.0,0.0,0.0},

{0.0,0.0,-1.0,1.0,0.0,0.0,0.0,-1.0,0.0},

{0.0,0.0,1.0,-1.0,0.0,0.0,0.0,-1.0,0.0},

{0.0,-1.0,0.0,0.0,0.0,-1.0,1.0,0.0,0.0},

{0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,-1.0},

{-1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0},

{0.0,0.0,1.0,0.0,-1.0,0.0,1.0,0.0,0.0},

{0.0,-1.0,0.0,-1.0,0.0,0.0,0.0,0.0,-1.0},

{-1.0,0.0,0.0,0.0,0.0,-1.0,0.0,-1.0,0.0},

};

return 0;

}

C语言 数组指针赋值出错

char *string[20];这样声明的是一个名为string的数组,这个数组有20个元素,每一个元素都是一个char *型指针。所以数组里存放的是“指针”,只是个4字节变量,它还没有指向,就不能用string[i][j]='\0';这种办法给它的指向目标赋值。要么直接把char *string[20];改成char string[20][100];(可以存放20个长99的字符串),要么在char *string[20];后用malloc等函数分别为20个指针分配空间。