#: 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.
|