Some basic array or structure program

This is a discussion on Some basic array or structure program within the C Programming forums, part of the General Programming Boards category; But they are integers. A char is nothing more than a smaller int. For instance 'A' has value 65 decimal, ...

  1. #16
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,175
    But they are integers. A char is nothing more than a smaller int. For instance 'A' has value 65 decimal, 'B' has the value 66 decimal, and so forth. This is what C "sees". When you use the character constant 'A', C sees 65 (well, it actually sees 01000001 (65 in binary) I guess, but that's beside the point). So you can just do if(input_character >= 'A' && input_character <= 'Y') to see if it's one of those characters.
    Last edited by itsme86; 03-10-2005 at 10:58 AM.
    If you understand what you're doing, you're not learning anything.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 08:25 PM
  2. Strange structure array issue...
    By IndioDoido in forum C Programming
    Replies: 9
    Last Post: 03-23-2008, 07:29 AM
  3. Dynamic structure with array and array count
    By Nazgulled in forum C Programming
    Replies: 14
    Last Post: 06-08-2007, 11:10 PM
  4. Need some help with a C program...
    By pityocamptes in forum C Programming
    Replies: 1
    Last Post: 03-25-2005, 06:43 PM
  5. My Program
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 02-27-2002, 02:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21