Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It may be useful to compile/run 01_PostPreFixIntro.c to quickly see how post/prefix with dereferencing works. For Task 1, Consider the below expressions a) - d).

image text in transcribed

It may be useful to compile/run 01_PostPreFixIntro.c to quickly see how post/prefix with dereferencing works. For Task 1, Consider the below expressions a) - d). wrapped into a while loop. Let abe the original expression. (a) (out =my_ptr++) !=0. The expression (b-d) adds 0 to a) to control precedence - your task is to investigate how 0 impacts the results, and print the result on the terminal. Test all out them out using printfo. a. printf( "a) while( (out =*my_ptr++) != 0) \{ " "); b. printf( "b) while( (out =(my_ptr++))!=0){} " ); c. printf( "c) while( (out =( my_ptr++) ) != 0) \{ } " ); d. printf( "d) while( (out = (*my_ptr)++) != 0) \{\} " ); and explain what does e) do below: e. printf( "d) while ( out = my_ptr+t!= 0 ) \{\} " ); Implement a-d in the code, avoid any infinite loops so it iterates at most 10 iterations. Add a counter and a break statement if needed. Background refresher below (skip forward if you understand operator precedence): of adding parenthesis to supersede or to clarify readability of an expression. x=5+65;// has higher precedence than + is equivalent to: x=5+(65); Task 2: Create a single similar while loop that creates the same output as a) BUT that uses prefix increment ++my_ptr, instead of the postfix above, that includes dereferencing, i.e., *++my_ptr HINT Be careful how you initialize the loop (it will take some thought)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions