for assembly. I don\'t need the whole code just a line of code for each problem.
ID: 3855965 • Letter: F
Question
for assembly. I don't need the whole code just a line of code for each problem. Please answer all questions for a thumbs up
Given an unsigned int fabio, write a C++ to do the following 1.) Change bits 4, 8, and 13 to 1. 2.) change bits 1,4 and 9 to 0. 3.) Check if bit 23 is a 1 or 0. 4) Given an array declared in c++ int ar[39][20][15][2] write an expression ar[4][6][10][1] without brackets 5) assume ar in 4) has been declared int **** ar assume that same amount of space has been dynamical allocated. write code to acess element [4][6][10][1] without brackets.
Explanation / Answer
The answer is as follows:
1) Change bit 4,8,13 bits to 1 given an unsigned int fabio
fabio = fabio | 8464; // 8464 = 10000100010000
2) Change bit 1,4,9 bits to 0 given an unsigned int fabio
fabio = fabio & 4294966765; // 4294966765 = 11111111111111111111110111101101
3) Checking if bit 23 is 1 or 0
fabio = fabio & 8388608; // 8388608 = 10000000000000000000000
if after the above operation the value of fabio is 0 it means 23rd bit is 0 and if after the opeartion the value of fabio is 8388608, this means that 23rd bit is 1
4) The array is declared as follows:
int ar[39][20][15][2];
we need to access ar[4][6][10][1] without brackets. It is as follows:
*(*(*(*(ar+4)+6) + 10) + 1)
5) The array is dynamically declared as follows:
we need to access ar[4][6][10][1] without brackets. It is as follows:
*(*(*(*(ar+4)+6) + 10) + 1)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.