Question: Write a function called safeIncrement ( var , limit ) that will increment the variable var if doing so will not cause it to exceed
Write a function called safeIncrementvar limit that will increment the variable var if doing so will not cause it to exceed the limitThe parameter var should be a pointer to the integer variable to increment. limit should be an integer giving the maximum value. The function should return if it was able to increment the variable, or if it could not.An example of how your function will be used is:int movementneeded; Function to check sensor and show if arm movement neededvoid movearmint; Function to move the robot armint armposition ; Position of a robot arm which must be between and while movementneeded if safeincrement&armposition, movearmarmposition;
Please note: you should not write a main function. Assume that all necessary #include statements, the main function, and the printf statements to display output have all been implemented. You should write only the safeincrement function
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
