Results 1 to 4 of 4

Thread: C programming Homework help ci vous plais

  1. #1
    Join Date
    Jan 2012
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default C programming Homework help ci vous plais

    Hey guys, I know there are a lot of good programmers on this forum! I'm kind of new to programming and need some help with part of my assignment.

    1.
    char a = 0x84;
    char b = 0132;
    char c;
    c = (a | b) & 91;
    printf(“symbol is %c”, c);

    I know 0x84 = 1000 0100
    and 0132 = 0101 1010

    (a|b) = 1101 1110

    But what is c = ?, i dont understand what it means by '&91'

    2.

    Supposed your PIC and LCD display are connected and properly connected. What does
    this command do?

    printf(“%c%c”, 0376, 0b11000011);

  2. #2
    Join Date
    Nov 2011
    Posts
    1,532
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    1.

    c is the result of 11011110b bitwise AND 91d (which is 01011011b)
    I did this in a hurry, seems to be 01011010b which is 90.

    2.

    0376 in decimal is 254 and the binary is 195
    check ASCII table for the result?
    it seems to be a filled square and a T rotated 90degs to anticlockwise.
    Last edited by Er1k; 02-06-2012 at 06:30 AM.

  3. #3
    Join Date
    Jan 2012
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    hey thanks for the reply.

    questions tho, 1. why do you say 91d? and what did u do the 11011110 and the binary which u got fron 91d to get 010111010b?

    2. I dont think that is right cause the decimal value of the ascii chart our prof gave us only goes up to 133

  4. #4
    Join Date
    Nov 2011
    Posts
    1,532
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    1101 1110
    0101 1011 AND
    --------------
    0101 1010 = 64 + 16 + 8 + 2 = 90

    2. There's an ASCII extended chart that goes up to 255. I don't have a C compiler installed on my machine so I can't confirm for you, but why don't you write a program to see for the results yourself?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •