SRL Archive - News and General

C programming Homework help ci vous plais


hammad911

2012-02-06 01:12:33

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);

Er1k

2012-02-06 01:25:21

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.

hammad911

2012-02-06 01:52:30

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

Er1k

2012-02-06 10:10:54

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?