delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/04/22:16:43

From: David Shirley <shirleyd AT cs DOT curtin DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Sizeof and pointers
Date: Thu, 05 Feb 1998 03:59:10 +0800
Organization: APANA Western Australia
Lines: 26
Message-ID: <34D8C88E.2849A0A@cs.curtin.edu.au>
NNTP-Posting-Host: dialup05.odyssey.apana.org.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

Ok heres my problem,

void func(unsigned char *tmp)
{
// BLAH BLAH
}

How do i find how many bytes tmp is taking up in memory:

the sizeof funtion returns 4 bytes, the reason being (i think) that it
is finding out how many bytes the pointer takes up in memory. I dont
want to use strlen(tmp) because the string may have a '\0' character.

Can someone tell me how to find out how many bytes tmp takes up in
memory, OR how to declare it so that sizeof(tmp) will return the correct
number?

thankz

D.




- Raw text -


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