domingo, marzo 27, 2005

Bytes que ocupa un programa

El siguiente programa podemos ver cuantos bytes ocupa un numero (integer,float,double) :

Programa: Bytes enteros
Extensión: .pas (pascal)

program bytes_enteros;
uses crt;
var
a:integer;
begin
clrscr;
writeln('el numero de bytes que ocupa' , sizeof(a));
writeln('Indique el numero: ');
readln(a);
writeln('el numero es: ',a);
readln;
end.

Sabemos que un:
Entero tiene 2 bytes
Float tiene 4 bytes
Double tiene 8 bytes