Question

If i have an array that i know is in address 0x40001008, given the below code...

If i have an array that i know is in address 0x40001008, given the below code what are the values of arrayptr and x?

unsigned short array[5] = {0x123, 0x456, 0x789, 0xabc, 0xdef};

unsigned char *arrayptr = (unsigned char *)array +3;

unsigned short x = *arrayptr;

Homework Answers

Answer #1

Base address of the array called array is 0x40001008 or 40001008H given in Hexadecimal number system.

1.) arrayptr is a character pointer which is assigned the value = (unsigned char *)array + 3 , the array pointer is typecasted into a character pointer i.e. (unsigned char *)array and adding 3 to it will increase it by 3 byte as char occupies 3 byte so the value of arrayptr = 0x4000100B using the calculation given below.

0x40001008
+ 3
Ans 0x4000100B

since 8+3 = 11 in decimal system and 11 = B in hexadecimal system.

2.) x is assigned the value at adress location 0x4000100B and at the address 0x4000100A the value 0x456 is present i.e. (0100 0101 0110) in binary and (1110) in decimal , so the value of x is 4.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In Java is there a way I can put a value in a linkList = array[...
In Java is there a way I can put a value in a linkList = array[ ] string (I don't know how to word it here what I have so far with my code) * Example object 51 I want to equal Array [0]; // Project code below public String getCardRank() { String values[] = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace"}; return "RRR"; } // this part is in another .java file private...
IN JAVA PLEASE write code to MERGESORT an array of user inputted OBJECTS you have two...
IN JAVA PLEASE write code to MERGESORT an array of user inputted OBJECTS you have two different classes in the program being made as objects in the main (Bunny class and Dog Class). ask the user "what kind of animal would you like to sort?" user chooses the type of animal (bunny or dog), then you ask the user how big would you like the array of animals to be (maximum array size = 20)? and then you ask what...
Fill in the code for the function below called containsAvgValue. It takes as input a float...
Fill in the code for the function below called containsAvgValue. It takes as input a float array of any length and returns 1 if the array happens to contain a value that equals the average of all the values in the array or 0 otherwise. For example, when give the array [2.0, 2.0] it should return 1 since the average value is 2.0 and the array contains that value. To help you, I’ve included a function that computes the average...
Given the array below, provide the JS code to loop through the array and print each...
Given the array below, provide the JS code to loop through the array and print each item to the console prepended by "Harry Potter and the " var books = [ "Philosopher's Stone (1997)", "Chamber of Secrets (1998)", "Prisoner of Azkaban (1999)", "Goblet of Fire (2000)", "Order of the Phoenix (2003)", "Half-Blood Prince (2005)", "Deathly Hallows (2007)" ] The console output should be: Harry Potter and the Philosopher's Stone (1997) Harry Potter and the Chamber of Secrets (1998) Harry Potter...
Given an array of integers return the sum of the values stored in the first and...
Given an array of integers return the sum of the values stored in the first and last index of the array. The array will have at least 2 elements in it --------------------------------------- public class Class1 { public static int endSum(int[] values) {     //Enter code here } }
[Java] I'm not sure how to implement the code. Please check my code at the bottom....
[Java] I'm not sure how to implement the code. Please check my code at the bottom. In this problem you will write several static methods to work with arrays and ArrayLists. Remember that a static method does not work on the instance variables of the class. All the data needed is provided in the parameters. Call the class Util. Notice how the methods are invoked in UtilTester. public static int min(int[] array) gets the minimum value in the array public...
Answer the questions based on the program given below. a) Write the function prototype of fnFunny...
Answer the questions based on the program given below. a) Write the function prototype of fnFunny function. b) Write the output produced by the above program #include <stdio.h> int main (void){       unsigned short i =4;       unsigned long j = 6 ;       short k = 2 ;       k = fnFunny ( i , j );       printf("i = %hu, j = %lu, k = %hi\n", i, j, k);       return 0; } short fnFunny (unsigned short i,...
1. An array has an index of [5] at the starting address of 200. It has...
1. An array has an index of [5] at the starting address of 200. It has 3 words per memory cell, determine loc[3],loc[4] and NE. (3 Marks: 1 mark for each) 2. A 2-D array defined as A[10 , 5] requires 4 words of storage space for each element. Calculate the address of A[4,3] given the base address as 250 • If the array is stored in Row-major form • If the array is stored in Column-major form 3. Write...
This is the java code that I have, but i cannot get the output that I...
This is the java code that I have, but i cannot get the output that I want out of it. i want my output to print the full String Form i stead of just the first letter, and and also print what character is at the specific index instead of leaving it empty. and at the end for Replaced String i want to print both string form one and two with the replaced letters instead if just printing the first...
Hi, I have this task about convolution and I need to write it as a code...
Hi, I have this task about convolution and I need to write it as a code in matlab. I have input signal x[n]=0.3 ∗ sin(n/5) + sin(n/50) : a) Create your own delta signal h[m] that removes the higher frequency sinusoidal component to get yl[n]. b) Subtract the yl[n] from the original signal(x[n]) and get the higher frequency component yh[n] (pay attention to array sizes and phase shift) . c) Plot x[n], yl[n] and yh[n] on the same graph
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT