[plug] [OT] Arg!! C Pointers on Char Arrays

Jim Householder nofixed at westnet.com.au
Sat Feb 19 14:15:03 WST 2005


Timothy White wrote:
> I am having some problems with pointers in C. Now I don't want someone
> to say go to C++ or something like that. I am using someone else's code
> and adding parts to get it to do what I want.
> 
> Basically I have a struct of form:
> struct critter
>  {
>    const char *name;
>    const char *species;
>  };
> 
> and I define a global array of this struct.:
> struct critter muppets[100];

As John has pointed out, you need to save the data.  You are saving 
pointers, but nothing for them to point to...

Jim



More information about the plug mailing list