Article View: comp.os.msdos.programmer
Article #7531Re: structures >64K
From: Harvey G Shulman
Date: Fri, 08 Jan 1993 15:35
Date: Fri, 08 Jan 1993 15:35
51 lines
1939 bytes
1939 bytes
To: psykseth@aau.dk
Subject: Re: structures >64K
Newsgroups: comp.os.msdos.programmer
In-Reply-To: <1993Jan8.135612.14930@aau.dk>
Organization: The Ohio State University
Cc:
Bcc:
Seth: the code below compiled and ran without error under
turbo c's huge model. Make sure you select this model on
the compiler option menu.
It would probably work as well under the
large model with the pointer declaration changed to
yynew huge *yycrank, j;
I wasn't able to come up with a good way to initialize the
allocated records but the technique below of initializing the
fields of another record, j, and then assigning it to the record
pointed to by yycrank seemed to work.
#include <stdio.h>
#include <stdlib.h>
#include <alloc.h>
void main()
{
int i;
typedef struct yynew {int current, advance;} yynew;
yynew *yycrank, j;
/* in the allocation statement I could not see why you used 20000L.
after all 20000 is 20000, isn't it? */
yycrank = farmalloc(20000 * sizeof(yynew));
for (i = 0; i < 20000; i++)
{ j.current = 0;
j.advance = i;
*(yycrank+i) = j ;
};
}
in the above loop I tried several variants of assignment to the
fields of yycrank's records without success. Maybe someone else can
describe how to do such things as *(yycrank+i).current = 0
--
Harvey Shulman
Ohio State University, Dept of Psychology
614 292-2759 / h.shulman@osu.edu
Technical Details
Message-ID:
<1993Jan8.153555.21210@magnus.acs.ohio-state.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!hshulmanReferences:
<1993Jan8.135612.14930@aau.dk>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!hshulman From: hshulman@magnus.acs.ohio-state.edu (Harvey G Shulman) Subject: Re: structures >64K Message-ID: <1993Jan8.153555.21210@magnus.acs.ohio-state.edu> Keywords: struct, huge Sender: news@magnus.acs.ohio-state.edu Nntp-Posting-Host: top.magnus.acs.ohio-state.edu Organization: The Ohio State University References: <1993Jan8.135612.14930@aau.dk> Date: Fri, 8 Jan 1993 15:35:55 GMT Lines: 51