User Tools

Site Tools


haas:spring2020:common:character_data

Character Data

#include <stdio.h>
 
int main()
{
    char a, b, c;
 
    a = 0x41;
    b = 97;
    c = '1';
 
    printf("a is %hhu but can be mapped to '%c' in ASCII\n", a, a);
    printf("b is %hhu but can be mapped to '%c' in ASCII\n", b, b);
    printf("c is %hhu but can be mapped to '%c' in ASCII\n", c, c);
 
    a = a + 1;
    b = b - ' ';
    c = c * 2;   // this is a *, we are multiplying
 
    return(0);

Questions

  • What will the numeric and character results for a, b, and c be after the above equations?
  • And more importantly: WHY?
  • Does this code compile? If not, what is missing?

Look into these, and be sure to write some of your discoveries in your journal.

haas/spring2020/common/character_data.txt · Last modified: 2013/02/06 15:02 by 127.0.0.1