Question

Given the following: int xyz[9] = {88, 99, 22, 15}; int *ptr = xyz; and assuming...

Given the following:

int xyz[9] = {88, 99, 22, 15};

int *ptr = xyz;

and assuming that xyz is stored at memory address 2500, what is the value of each of the following?

  1. xyz[0]
  2. xyz[2]
  3. xyz[4]
  4. xyz[9]
  5. &xyz[0]
  6. ptr
  7. *ptr
  8. *ptr+1
  9. *(ptr+1)
0 0
Add a comment Improve this question Transcribed image text
Answer #1
xyz[0] is 88
xyz[2] is 22
xyz[4] is not valid
xyz[9] is not valid
&xyz[0] is 2500
ptr is 2500
*ptr is 88
*ptr+1 89
*(ptr+1) 99
Add a comment
Know the answer?
Add Answer to:
Given the following: int xyz[9] = {88, 99, 22, 15}; int *ptr = xyz; and assuming...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ questions need help QUESTION 1 Given the following code, what is the value of *ptr?...

    c++ questions need help QUESTION 1 Given the following code, what is the value of *ptr? int var = 5; int *ptr = &var; int *myptr = ptr; *ptr = -8; var = 0; *myptr = 2; a. 2 b. -8 c. 5 d. 0 QUESTION 2 Given the following code, what is the value of ptr+1? int arr[3] = {0, 0, 0}; int *ptr = arr; *ptr = 8; a. 9 b. undefined c. the address of arr[0] d....

  • C++ Question 15 3.95 pts struct Person int age; char gender; double weight: string name; Person...

    C++ Question 15 3.95 pts struct Person int age; char gender; double weight: string name; Person p[35, 'M', 175.5, "Steve"); Which of the options below correctly represents how the structure object p is stored in memory? RAM (Memory) Address Value Address o Address 1 Address 2 Address 3 Address 4 Which of the options below correctly represents how the structure object p is stored in memory? B-) RAM (Memory) Address Value Address 0 Address 1 Address 2 Address 3 Address...

  • #include <stdio.h> int main(int argc, char *argv[]) {      char a, *pc, c[9];      int i, *pk, k[9];      a='...

    #include <stdio.h> int main(int argc, char *argv[]) {      char a, *pc, c[9];      int i, *pk, k[9];      a='z';      pc=&(c[8]);      pk=&(k[0]);      for (i=0; i<9; i++)     {           *pc=a-(char)i;           pc--;           *pk=(int)a-i;           pk++;           }                     return 0; }//end of main Answer the below questions with the above code Write out the memory map for the above C code in the following table. For array variables, list the address range for the entire array. Assume the memory address starts from 100, that is, the address for a...

  • in java, Hash 8 randomly generated int values (in the range [ 0 - 99 ]...

    in java, Hash 8 randomly generated int values (in the range [ 0 - 99 ] inclusive). The random number generator is initially seeded to value 97. Each generated value is stored in a hash table size 11. The first hash function, h1(key) is the division modulo sizeof(table). I.e., h1(key) = key % sizeof(table) h1(key) = key % 11. Any collisions will NOT be stored in the hash table. You will ignore collisions. The hash table is a random access...

  • 51. What is the output of the following code snippet? int number = 0; int ptr_num...

    51. What is the output of the following code snippet? int number = 0; int ptr_num -&number ptr_num 60; number-80 cout < "ptr num << endl b, 60 c. 80 d. the address of number Answer 52. What is the output of the following code snippet? double num-0.0; double* ptr = &num; num = 15.0; ptr ptr 15.0 cout << num <<"ptr <<endl; a. 15 15 b. 15 30 С. 30 15 d. 30 30 Answer: 53. What is the...

  • Consider the following C program: int maino short S; printf("Address of S is %d\n", &S); //...

    Consider the following C program: int maino short S; printf("Address of S is %d\n", &S); // printf() Statement 1 printf("%d", S); // printf( Statement 2 return 0; Assume variable "S" is a TWO BYTE, TWO'S COMPLEMENT (SIGNED) "short integer" stored in memory in LITTLE-ENDIAN format (.e. least significant byte at the lowest address). When the program is run, printfo Statement 1 produces the following output: Address of S is 5865 Given the contents of the portion of memory shown in...

  • Given the following function: int fun1(int count){ int Num ; for (i = 0; i <...

    Given the following function: int fun1(int count){ int Num ; for (i = 0; i < count; ++i) { cin >> Value; if (i == 0) Num = Value; else if (Value > Num) Num = Value; } return Num ; } What is the output of the following C++ code segment if the following list is entered? (Input list:  5 -15 -90 -2 -60 -30) int Num = 0 , Value, numValues; cin >> numValues; if (numValues > 0) cout...

  • . Assuming that the following integer array ArrayInts [ ] = {54, 99,-8, 5, 124, 29,...

    . Assuming that the following integer array ArrayInts [ ] = {54, 99,-8, 5, 124, 29, -13,260, 29,-4, 100, 12, 15, 58, 164, 480, 60) is stored in the memory. Write a complete C language program that: computes the sum of all even integers in the array and displays the result on the console, computes the sum of all odd integers in the array and displays the result on the console, and Searches the array for the target value of...

  • Given the following code segment, int x = 20; int y = 7; what is the...

    Given the following code segment, int x = 20; int y = 7; what is the data type of the value of the expression (x % y) ? (3 points) Question 1 options: 1) int 2) double 3) numeric 4) Error: possible loss of precision 5) Unable to be determined Question 2 (3 points) Given the following code segment, double x = 42.3; double y = 11.7; what is the data type of the value of the expression (x %...

  • Q 2. Assuming a 32-bit operating environment, identify the mode of each operand in the following...

    Q 2. Assuming a 32-bit operating environment, identify the mode of each operand in the following instructions. (Note: There are two operands in each instruction; identify both modes.) For a memory operand, specify whether it is direct memory mode or register indirect memory mode. Assume that the instructions are in a program also containing the code. .DATA value DWORD ? char BYTE *1. mov value, 100 2. movecx, value 3. mov ah, Oah *4. moveax, (esi] 5. mov [ebx], ecx...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT