Path: utzoo!attcan!uunet!virtech!cpcahil
From: cpcahil@virtech.UUCP (Conor P. Cahill)
Newsgroups: comp.lang.c
Subject: Re: pointer increment
Summary: use char * instead
Message-ID: <1004@virtech.UUCP>
Date: 12 Aug 89 15:39:08 GMT
References: <484@eagle.wesleyan.edu>
Organization: Virtual Technologies Inc
Lines: 11

In article <484@eagle.wesleyan.edu>, dkonerding@eagle.wesleyan.edu writes:
>         Now, say I make ptr=1000 or hex 3e8.  I want to add one to the ptr, to
> make it point to 1001, or hex 3e9.  Every time I do a ptr=ptr+1, it becomes
> 3ec.  How can I simply increment ptr by one?

By declaring the pointer as char * ptr;

an increment of a pointer moves the pointer to the next occurance of the
item to which it points to.  In your case I am assuming an integer is 4
bytes and the compiler correctly moved the pointer to point to the next
integer that ptr may point to.  This goes the same for structures.