Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Type the meaning of every single line of the code using a comment as shown in first few lines. #include // Header use for input/outputs
Type the meaning of every single line of the code using a comment as shown in first few lines. #include// Header use for input/outputs #include // Declares a set of functions for standard input/output. // It is also defines I/O stream objects such as cin, cout, etc. int main(void) // This function can be used as well int main() { printf(" LAB_No_04_Memory_Address "); // Lab number and lab name here printf(" Module: C++ Programming approach "); // Lab module and title hereand title here printf(" Mahfuz Adil, ID#23486522 "); // Student's name here printf(" CET3510-E205 "); // Student's Class here printf(" Submission date: February 13, 2019 "); // Date of the Student's program when submitted here printf(" Due date: February 20, 2019 "); // Date of the Student's program due date printf(" Example 4.2 addressContentTemp16bits.cpp "); // Student's file name for the program here printf(" File name: addressContentTemp16bits.cpp "); // Student's file name for the program here printf("----------------------------------------- "); int const size = 4; short int sc16_arr[4] = { -1, -3,1000,2000 }; short *svPtr0, *svPtr1, *svPtr2, *svPtr3; int md[4], madd[4]; int i; svPtr0 = &sc16_arr[0]; svPtr1 = &sc16_arr[1]; svPtr2 = &sc16_arr[2]; svPtr3 = &sc16_arr[3]; //Display Hexadecimal value, decimal value, and char value for each element of char array printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); printf("--------------------The value of each element of 16-bit array----------------- "); for (i = 0; i < 4; i++) { printf("The value of element %d in an array is 0x%x (hex), %d (decimal), %c (character) ", i, sc16_arr[i], sc16_arr[i], sc16_arr[i]); } //Display address in hexadecimal for each element of char array printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); printf("-----------------The address of each element of 16-bit array----------------- "); for (i = 0; i < 4; i++) { printf("The memory address of element %d in an array is 0x%X (hex) ", i, svPtr0 + i); } printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); //Find the total numbers in byte of array sc16_arr[4] printf("----------------The size information in bytes of an 16-bit array------------- "); printf("The total number in byte of an 16-bit array with 4 element is %d byte ", sizeof(sc16_arr)); //Find the numbers of byte(s) of each element of array sc16_arr[4] for (i = 0; i < 4; i++) { md[i] = sizeof(sc16_arr[i]); // This convert the array element into bytes madd[i] = sizeof(svPtr0 + i); // This convert the address of the array into bytes printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); printf("The size of element %d is %d byte ", i, md[i]); printf("The size of the address of the element %d is %d bytes ", i, madd[i]); } system("pause"); return (0); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started