Question: / / addressContentTemp 1 6 Bits.cpp / * * * * * * * * * * * * * * * * * *

//addressContentTemp16Bits.cpp
/************************************************************/
#include
#include
using namespace std;
int main(){
// Display year and month
SYSTEMTIME a;
GetLocalTime(&a);
cout << "Year: "<< a.wYear << endl;
cout << "Month: "<< a.wMonth << endl << endl;
/*An 16-bit one dimensional arr16[4] array declaration and initialization.
Pointers of Ptr[N] will be used to store the address of
each element of the array.
A 32-bit array md[N] will be used to store size of each element
in the arr16 array
A 32-bit array madd[N] is used to store the size of the address of
each element of the array
*/
int const N =4;
short int arr16[N]={-1,20,1000,20000};
short int* Ptr[N];
//index used in for loop
int i;
//Display Hex value and decimal value for each element of short int array
cout <<"++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< endl;
cout <<"----------The value of each element of 16-bit array-----
"<< endl;
for (i =0; i < N; i++)
{
// Add your code here
}
//Find the total numbers in byte(s) of array arr16[N]
cout <<"--- The size information in bytes of an 16-bit array----
"<< endl;
cout << "The total numbers in byte(s) of an 16-bit array with 4 elements is:"
<< endl << endl;
//Add your code here
//Find the number of byte of each element of array arr16[N]
for (i =0; i < N; i++)
{
// Display size of each element in the array in byte(s)
//Add you code here
}
cout <<"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< endl;
//Find the address for each element in an array arr16[N]
//Store the address of each element into the array void *Ptr[N]
//Add your code
Ptr[0]= arr16;
//Ptr[1]=
//Ptr[2]=
//Ptr[3]=
//Ptr[4]=
//Display address in hexadecimal for each element of array
cout <<"----- The address of each element of 16-bit array------
"<< endl;
for (i =0; i < N; i++)
{
cout << "The memory address of element "<<0<<" in the array is:"
<<"(Hex)0x"<< hex << Ptr[0]<< endl;
//Add your code
}
cout <<"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<< endl;
//Find the number of byte(s) of each element of array
for (i =0; i < N; i++)
{
// Add your code
}
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!