www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/29/02:45:31

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: advance in allocated memory by 1 byte only
Date: 28 May 2000 23:33:28 -0700
Organization: Posted via Supernews, http://www.supernews.com
Lines: 19
Sender: nate AT mercury DOT bitbucket
Message-ID: <83ya4tx3uv.fsf@mercury.bitbucket>
References: <01BFC967 DOT 2C9F11E0 AT LEON DOT caresystems DOT com DOT au>
X-Complaints-To: newsabuse AT supernews DOT com
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Leon <Leon AT caresystems DOT com DOT au> writes:

> Hello
> i know one can use pointer arithmetic to advance the read/write location in memory allocated by malloc for example...
> 
> Now since the sizeof char is 1 byte - it is possible to use a pointer to char when moving 1 byte at a time.
> 
> but what about systems that may have different sizeof char (ie != 1 byte)
> 
> how would one then be able to move through a memory block by 1 byte only?

I believe sizeof(char) is defined to be 1.  So that is always the
smallest amount by which you can move things.  (However, on some
systems, that may not be 1 byte; it may be 1 word, for instance.)

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019