www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/28/00:56:51

Message-ID: <360F16AB.667D19B0@post.comstar.ru>
Date: Mon, 28 Sep 1998 07:55:07 +0300
From: Dim Zegebart <zager AT post DOT comstar DOT ru>
Reply-To: zager AT post DOT comstar DOT ru
Organization: Comstar Ltd.
MIME-Version: 1.0
To: Klaus Petzold <califax AT wupperonline DOT de>
CC: djgpp AT delorie DOT com
Subject: Re: Why GPF?
References: <360E58C8 DOT 1F87EAD1 AT wupperonline DOT de>


Klaus Petzold wrote:

> unsigned char *t;
>
> unsigned char readchar(unsigned char *ptr)
> {   unsigned char a;
>    a = (*t);
>    return(a);
> }

First, if you don't allocate memory for t it points to the void.
So, you either had to do t=(unsigned char*)malloc(1);
or t=&unsigned_char_variable;
Second, IMHO, your readchar() looks meaningless,
if you need to return content of memory cell pointed by ptr you should
alter code like next :
unsigned char readchar(unsigned char *ptr)
{
  return(*ptr);
}

--
Dim Zegebart
Moscow, Russia


- Raw text -


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