Question: Explain your codes please * Change the value pointed to by ptr byte-by-byte so that when returned as an integer * the value is 449449.

 Explain your codes please * Change the value pointed to by

Explain your codes please

* Change the value pointed to by ptr byte-by-byte so that when returned as an integer * the value is 449449. * Hint: Remember that an int is 4 bytes. Hint: Remember how little endian works for data storage, how is it different between an multiple bytes(int) and a single byte? Hint: It will be easiest to start convert 449449 into binary form and starting seeing how the endian works from there. ALLOWED: Pointer operators: * & Binary integer operators: -+ * Shorthand operators based on the above: ex. += *=, ++, --, etc. Unary integer operators: ! DISALLOWED: Pointer operators: [] (Array Indexing Operator) Binary integer operators: &, &&, I. II. , >, ==, !=, ^, 7, % Unary integer operators: ~, */ int endianExperiment(int *ptr) { char *bytePtr; // Your code here return *ptr; } * Change the value pointed to by ptr byte-by-byte so that when returned as an integer * the value is 449449. * Hint: Remember that an int is 4 bytes. Hint: Remember how little endian works for data storage, how is it different between an multiple bytes(int) and a single byte? Hint: It will be easiest to start convert 449449 into binary form and starting seeing how the endian works from there. ALLOWED: Pointer operators: * & Binary integer operators: -+ * Shorthand operators based on the above: ex. += *=, ++, --, etc. Unary integer operators: ! DISALLOWED: Pointer operators: [] (Array Indexing Operator) Binary integer operators: &, &&, I. II. , >, ==, !=, ^, 7, % Unary integer operators: ~, */ int endianExperiment(int *ptr) { char *bytePtr; // Your code here return *ptr; }

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 Databases Questions!