Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!decvax!tektronix!tekcrl!tekgvs!toma From: toma@tekgvs.TEK.COM (Thomas Almy) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: Re: Assigning to Pointers Message-ID: <2248@tekgvs.TEK.COM> Date: Wed, 29-Apr-87 11:52:04 EDT Article-I.D.: tekgvs.2248 Posted: Wed Apr 29 11:52:04 1987 Date-Received: Sat, 2-May-87 07:36:58 EDT References: <3537@vrdxhq.UUCP> Reply-To: toma@tekgvs.UUCP (Thomas Almy) Organization: Tektronix, Inc., Beaverton, OR. Lines: 28 Xref: mnetor comp.sys.ibm.pc:3648 comp.lang.c:1986 In article <3537@vrdxhq.UUCP> tekgvs!tekcrl!tektronix!uw-beaver!teknowledge-vaxc!sri-unix!husc6!seismo!vrdxhq!tom tom@vrdxhq.UUCP (Tom Welsh) writes: > >This may be a dumb question, but could someone please explain >to me how I assign an absolute address to a pointer to an array? >... >I'm using MSC 4.0 > I thought that this would be general enough to followup rather than reply. You have to remember that addresses of "far" data structures are longs and not ints. For SMALL or MEDIUM memory models (i.e., one data segment), you can say int far *aa[]; /* aa is a far pointer to an array of ints */ aa = (int far *) 0x50000L; /* for a fixed address */ #define absAddress(segment,offseg) (((long)(segment) << 16) + (offseg)) aa = (int far *) absAddress(5,0); /* for convenience */ For COMPACT or LARGE memory models (i.e., more than one data segment), just delete the keyword "far" from the preceeding examples. Tom Almy (I hate C, but use it twice a day)