Re: Hexadecimal index array



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
.



Relevant Pages

  • Re: Hexadecimal index array
    ... > I am handling an array with a hexadecimal index for the first time. ...
    (comp.lang.c)
  • Re: Hexadecimal index array
    ... >> I am handling an array with a hexadecimal index for the first time. ...
    (comp.lang.c)
  • Re: functional programming
    ... But if you're going to tromp over the original array straightaway ... Second-guessing such optimizations and hard-coding them in your source code can make the code more difficult to reason about and deal with in general, because it can put all of the properties I listed at risk. ... Mutation can be encapsulated locally in a controlled way that doesn't lead to problems, for example -- however, 'every' above is not encapsulated in that way. ...
    (comp.lang.scheme)
  • Re: Reading Source Code
    ... I self-taught myself C ... Imagine how humbling it was the first time some of my source saw ... >> study other's source code as diligently? ... > examples in books as a means of learning. ...
    (comp.programming)
  • Re: Seg Violation on startup
    ... The application crashes with a segv the first time it calls the ... There is a nasty bug in the Tk code which many have encountered and ... The Tk source code needs to patched, ... Other than that, you will need to file a bug report on cpan, under the ...
    (comp.lang.perl.tk)