Re: nested structures and initialization
- From: Keith Willis <me@xxxxxxxxxxx>
- Date: Wed, 31 Oct 2007 13:48:55 +0000
On Wed, 31 Oct 2007 13:11:09 -0000, Sheldon <shejo284@xxxxxxxxx>
wrote:
<much snippage>
<more snippage>
retv->operationalfile = NULL;
retv->tunedfile = NULL;
retv->radarfile = NULL;
c: In function `NewSatellite':
c:73: error: incompatible types in assignment
c:74: error: incompatible types in assignment
c:75: error: incompatible types in assignment
c:76: warning: statement with no effect
I told you in the email I sent you that your initialisation of these
strings was nonsense. You are trying to assign the value NULL to a
variable of type array-of-char. You need to set the first character
of the array-of-char to the value '\0', thus:
retv->operationalfile[0] = '\0';
Alternatively, initialise the entire string to zeros (overkill):
memset(retv->operationalfile, 0, sizeof retv->operationalfile);
What I am missing here?
Clues?
--
PGP key ID 0xEB7180EC
.
- References:
- nested structures and initialization
- From: Sheldon
- Re: nested structures and initialization
- From: Mark Bluemel
- Re: nested structures and initialization
- From: Sheldon
- nested structures and initialization
- Prev by Date: Re: The most important things to write a program
- Next by Date: Re: Hello, World!
- Previous by thread: Re: nested structures and initialization
- Next by thread: One question of C
- Index(es):
Relevant Pages
|