Assigning an address to an integer

Randy Azarian azarian at hpcc01.HP.COM
Fri Jun 1 08:19:38 AEST 1990


Can I assign an address of a variable to the value of a standard integer?

Like so:

{
  int a,d;

  a=&d;
  bdos(1,a,1);
}

This works, but gives me the following warning:

  warning C4047: '=' : different levels of indirection


By doing:

{
  int d;

  bdos(1,&d,1);
}

also works (and as far as I'm concerned, equivalent), but gives me 
the following two warnings:

   warning C4047: 'argument' : different levels of indirection
   warning C4024: 'bdos' : different types : parameter 2


The address should only contain the offset value (having the segment value
of the DS register), and should therefore be an integer, and should assign 
to a declared integer.  The is for PC's (Microsoft C 6.0), and I realize 
that it is probably different from other machines.

I suppose I only wish to eliminate the warning messages, because my
programs function fine.  Is there another way to achieve what I want
using pointers?



More information about the Comp.lang.c mailing list