www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/14/16:16:32

Date: Thu, 14 Jan 1999 16:16:28 -0500
Message-Id: <199901142116.QAA04862@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <369ece56.0@news1.jps.net> (slash747@jps.net)
Subject: Re: size_t
References: <369ece56 DOT 0 AT news1 DOT jps DOT net>
Reply-To: djgpp AT delorie DOT com

> could someone please explain to me how size_t works please?

size_t is a variable whose range of values covers all possible sizes
of other variables.  Example:

size_t a;
char b[100];
a = sizeof(b);  /* a is now 100 */
printf("a = %d\n", a); /* prints "a = 100" */

> ie. when you decalre a variable to be of type int at compile time it sets
> aside 2 bytes for the integer to be stored.

4 bytes.

> What happens when you declare a variable or function to be of type
> size_t ??

You get a variable that can hold the value of the size of any object.

- Raw text -


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