TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: Dan Charrois 70721,1506 (X)
from: Pete Lyall 76703,4230
date: 1990-08-14 15:11:33
subject: #6113-#_gs_opt

#: 6122 S3/Languages
    14-Aug-90  15:11:33
Sb: #6113-#_gs_opt
Fm: Pete Lyall 76703,4230
To: Dan Charrois 70721,1506 (X)

For starters, you DO have pointers, but they don't point to anything... more
likely, they point to something they're not supposed to.

Simply declaring the line:

 struct sgbuf *p, *q;

sets aside two variables that can HOLD a pointer to a structure of type
'sgbuf'. You never:

 a) Created a storage area that the data would be stuffed into

 b) Initialized either of these pointers to point to an area like
    the one described in a) above.

Try:

 #include 

 char buf1[32], buf2[32];

main()
   {
   struct sgbuf *p = buf1, *q = buf2;

    ... etc. ...
   }

It would have been more proper to allocate buf1 & buf2 as:

 struct sgbuf buf1, buf2;

Pete

There is 1 Reply.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.