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

From: Philip Trickett (philipt at domain informatic.ie)
Date: Tue 13 Apr 1999 - 10:47:27 IST


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 domain 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



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:07 GMT