Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Assigning an address to an integer Message-ID: <1990Jun1.170016.5337@utzoo.uucp> Organization: U of Toronto Zoology References: <1280003@hpcc01.HP.COM> Date: Fri, 1 Jun 90 17:00:16 GMT In article <1280003@hpcc01.HP.COM> azarian@hpcc01.HP.COM (Randy Azarian) writes: >Can I assign an address of a variable to the value of a standard integer? Any sensible compiler will reject this as a type mismatch. The address of a variable of type T is of type "pointer to T". This is not an integer type, and cannot be assigned to an integer variable. If you know what you are doing, the correct way to accomplish this is by casting the address to an integer type: i = (int) &x; The result of this is very implementation-specific and you need to know what your compiler is going to do about it. -- As a user I'll take speed over| Henry Spencer at U of Toronto Zoology features any day. -A.Tanenbaum| uunet!attcan!utzoo!henry henry@zoo.toronto.edu