Re: Hexadecimal index array
- From: Jack Klein <jackklein@xxxxxxxxxxx>
- Date: Tue, 12 Apr 2005 00:07:10 -0500
On 11 Apr 2005 21:40:47 -0700, askalra2002@xxxxxxxxx (Anjali) wrote in
comp.lang.c:
> Hi,
>
> I am handling an array with a hexadecimal index for the first time.
> What actually does the below means.
>
> arr[0x80] = { '@','£','$','@','@','@','@','@','@','@', 10,'@', 13,'@','@','@',
> '@','_','@','@','@','@','@','@','@','@','@', 32,'@','@','@','@',
> ' ','!','"','#','@','%','&', 39,'(',')','*','+',',','-','.','/',
> '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?',
> '@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
> 'P','Q','R','S','T','U','V','W','X','Y','Z','@','@','@','@','@',
> '@','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o',
> 'p','q','r','s','t','u','v','w','x','y','z','@','@','@','@','@'};
>
> what does an index 0x80 means n why can not one write 128 instead of 0x80?
>
> Anjali.
0x80 in a C program is a numeric literal of type int with a value of
128. One could write 128 instead of 0x80, or even 0200, which is a
numeric literal in octal that has the same value.
As for why the person writing the code used 0x80 instead of 128, one
can only guess. The two likeliest possibilities that come to my mind
are that he/she was showing off, of that he/she was making a point
that might make sense if one saw the rest of the source code.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.
- References:
- Hexadecimal index array
- From: Anjali
- Hexadecimal index array
- Prev by Date: Re: Hexadecimal index array
- Next by Date: Re: Random Integers from 0 to 999
- Previous by thread: Re: Hexadecimal index array
- Next by thread: Re: Hexadecimal index array
- Index(es):
Relevant Pages
|
|