Given the following code on Ada:

procedure Main is type Element_Type is mod 2**8; Irreducible_P : Element_Type := 2#10001101#; x,y : element_type; begin x:= 16#53#; y:= 16#ca#; ... end; 

In which number system are the Irreducible_P, x, y variables initialized?

    1 answer 1

    In Ada, the number before #...# is the base of the number system, and the characters between #...# are the numbers in it.

    Then the Irreducible_P variable is initialized in binary and is 141 decimal or 8d hexadecimal, which means Unicode Reverse Line Feed .

    x and y initialized in hexadecimal notation. 16#53# is a character (byte) with the code 83 decimal or 'S' in ASCII , and 16#ca# is 202 decimal and the type of character depends on the encoding. For example, in cp1251 (windows) it is the Russian letter 'К' , in KOI8-R the letter 'й' , and in Latin-1 the letter 'й' 'Ê' .

    (And, in fact, "if you look closely at a text in an unknown language, then gradually its meaning begins to reach you."
    Checked in Google and here it is written in the Literals section).

    • Thanks for the detailed explanation! - Artik
    • @AndriiArtamonov Tick the answer, if it helped you, this will allow the system to consider the issue resolved. - Timofei Bondarev