#include <stdio.h>
2 #define THIS Ox04
3 #define THAT Ox03
4
5 int main() {
6
unsigned char va=0x00;
7
va | = THIS;
8 va |= THAT;
9
if(va == THIS & THAT)
10 printf("%d", THAT);
11
if(va & THAT << 2)
12
printf("%d", THIS);
13 return 0;
14)}
Answers
Answer:
The program you made is wrong
Explanation:
test.c: In function ‘main’:
test.c:2:14: error: ‘Ox04’ undeclared (first use in this function)
2 | #define THIS Ox04
| ^~~~
test.c:9:9: note: in expansion of macro ‘THIS’
9 | va |= THIS;
| ^~~~
test.c:2:14: note: each undeclared identifier is reported only once for each function it appears in
2 | #define THIS Ox04
| ^~~~
test.c:9:9: note: in expansion of macro ‘THIS’
9 | va |= THIS;
| ^~~~
test.c:3:14: error: ‘Ox03’ undeclared (first use in this function)
3 | #define THAT Ox03
| ^~~~
test.c:10:9: note: in expansion of macro ‘THAT’
10 | va |= THAT;
| ^~~~
test.c:19:1: error: expected statement before ‘)’ token
19 | )
| ^
test.c: At top level:
test.c:21:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ at end of input
21 |
|
Answer:
The Output is "34"
Explanation:
There are some minor mistakes in the question. However, exact question by mitigating all the errors are given below with correct answer for the same question.
#include<stdio.h>
#define THIS 0x04
#define THAT 0x03
int main() {
unsigned char va = 0x00;
va |= THIS;
va |= THAT;
if (va == (THIS | THAT))
printf("%d",THAT);
if (va | (THAT > 1))
printf("%d", THIS);
return 0;
}
Output: "34"
#SPJ3