Sign in Join
Wiki copytemporary

Byte/fi

Deutsch · English · Español · Français · Italiano · Suomi · Русский · 中文(中国)

Byte on etumerkitön kokonaisluku alueella 0 .. 255. Se on 8 bittiä pitkä. Byte ja Char ovat samoja asioita paitsi byte voi viitata vain numereeniseen tyyppiin kun taas char käytetään merkeillä tai osana merkkijonoa. Eikä char:a voi käyttää matemaattisissa lausekkeissa.

Esimerkiksi:

pascal
 Var c: byte; 
 ch: char;

 begin
   c := 65;  ch := 'A';  { are the same action, and are legal }
   c := 'A'; ch := 65;   { while they are the same action, this is illegal }
 end.

Käyttämällä Byte:ä tai Char:a tietotyyppinä saadaan parempi dokumentaatio muuttujan yksityiskohtaisesta käyttäytymisestä. Byte-tyyppi voidaan pakottaa char:ksi käyttämällä chr-funktiota. Char-ttyppi voidaan pakottaa byte:ksi käyttämällä ord-funktiota.

yllä oleva ohjelma korjattuna:

pascal
 Var c: byte; 
 ch: char;

 begin
   c := 65;  ch := 'A'; { are the same action, and are legal }
   c := ord('A'); ch := Chr(65); { now legal }
 end.

From the Free Pascal wiki, page "Byte/fi", as it stood on 2020-02-10 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.