--- Jeremy Hill <[EMAIL PROTECTED]> wrote:
> struct {
> ...
> struct
> {
> int kills;
> int battlefields;
> } *total;
> ....
> } *bfield_data;
>
>
> This crashes:
>
> char buf[MAX_INPUT_LENGTH];
> sprintf (buf, "No. of bfs, total: %d\n\rNo. of kills, total: %d\n\r",
> bfield_data->total->battlefields, bfield_data->total->kills);
> send_to_char (buf, ch);
>
> What am I doing wrong?
>
You're derefrencing pointers you haven't allocated.. If there's only one
instance of this struct (and it's not a complex data type) you can just use it
directly. No sense mucking about with pointers, and it will save you having to
do the allocation/deallocation yourself.
=====
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$
P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O
M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@
b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
------END GEEK CODE BLOCK------
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com