Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!pasteur!helios.ee.lbl.gov!ncis.tis.llnl.gov!lll-winken!csustan!csun!csuna!abcscagz From: abcscagz@csuna.csun.edu (Jeff Boeing) Newsgroups: comp.lang.c Subject: Pointer incrementation and assignment Message-ID: <2015@csuna.csun.edu> Date: 25 May 89 21:58:21 GMT Reply-To: abcscagz@csuna.csun.edu (Jeff Boeing) Organization: California State University, Northridge Lines: 33 This has bugged me for quite some time.... int *a; Say you implement this on a machine that uses byte addressing (memory location 4000 contains 1 byte, memory location 4001 contains 1 byte, and so on), and this particular C compiler, quite justifyably, interprets an "int" to be a signed two-byte value. Now, by definition, when you do this: a++; You increment the actual address stored in a by TWO, not just by one. Furthermore, if the compiler allows it, this is also perfectly legal: a = 4000; This sets a to point to memory location 4000. A subsequent a++ would increase a to 4002. But would doing this: a += 1; increase a by 1 or by 2? Or how about a = a + 1; ?? Inquiring minds want to know! -- Jeff Boeing: ...!csun.edu!csuna!abcscagz (formerly tracer@stb.UUCP) ---------------------------------------------------------------------------- "Let's split up -- we can do more damage that way." -- Gh0stbusters