[ILUG] Hi, just a quick question (again!!)

Philip Trickett philipt at informatic.ie
Tue Apr 13 10:47:27 IST 1999


Hi, I have just created a C program that uses structures.  My trouble is
that whn I define a field in the structure as an array of char for a
string, I get an error when I try to initialise the value.

The code looks like:

struct instrument {
  char name[60];  /* Name of the Instrument */

........
}; /* Instrument Structure Definition */

...
struct instrument conn_inst[8]; /* Create a structure to store inst.
details */

....

conn_inst[0].name = "Blah Blah Blah";

......

The error I get is:

[phil at jalapeno src]$ gcc main.c
main.c:73: incompatible types in assignment


Does anyone have any ideas, as every book etc. i have checked has indicated that this is an OK way to do this.

Cheers,

Phil







More information about the ILUG mailing list