S
shan_rish
Hi CLCers,
In the below program the error message while compiling is
/home1/murugan/prog/cprog >cc -o struct_eval struct_eval.c
cc: "struct_eval.c", line 14: error 1549: Modifiable lvalue required
for assignment operator.
cc: "struct_eval.c", line 17: error 1549: Modifiable lvalue required
for assignment operator.
cc: "struct_eval.c", line 18: error 1549: Modifiable lvalue required
for assignment operator.
/home1/murugan/prog/cprog >
In line 13 iam initilaising the char array test2 with "Test\n"
successfully, but for other char arrays the above error is thrown. Any
help in understanding the problem is appreciated. The program is
#include<stdio.h>
int main()
{
struct data
{
char char1[100];
char char2[100];
};
char test1[100];
char test2[100]="Test\n";
test1 = "Test\n";
struct data data1;
data1.char1="Char 1 Data1\n";
data1.char2="Char 2 Data1\n";
printf("Plain Struct1 = %s \n Plain Struct1 = %s \n", data1.char1,
data1.char2);
return 0;
}
Thanks in advance.
Cheers
Shan
In the below program the error message while compiling is
/home1/murugan/prog/cprog >cc -o struct_eval struct_eval.c
cc: "struct_eval.c", line 14: error 1549: Modifiable lvalue required
for assignment operator.
cc: "struct_eval.c", line 17: error 1549: Modifiable lvalue required
for assignment operator.
cc: "struct_eval.c", line 18: error 1549: Modifiable lvalue required
for assignment operator.
/home1/murugan/prog/cprog >
In line 13 iam initilaising the char array test2 with "Test\n"
successfully, but for other char arrays the above error is thrown. Any
help in understanding the problem is appreciated. The program is
#include<stdio.h>
int main()
{
struct data
{
char char1[100];
char char2[100];
};
char test1[100];
char test2[100]="Test\n";
test1 = "Test\n";
struct data data1;
data1.char1="Char 1 Data1\n";
data1.char2="Char 2 Data1\n";
printf("Plain Struct1 = %s \n Plain Struct1 = %s \n", data1.char1,
data1.char2);
return 0;
}
Thanks in advance.
Cheers
Shan