Question: (15pt) Consider the function below, where you get a pointer pi to the first and a pointer p2 to the last character of the same

 (15pt) Consider the function below, where you get a pointer pi

(15pt) Consider the function below, where you get a pointer pi to the first and a pointer p2 to the last character of the same string. The function should return a pointer to the character in the middle of the string (in case of an even size consider the leftmost). char *midchar (char *p1, char *p2) ( return (p1 + p2) / 2; A thoughtful 212 student should notice that adding together pointers is likely to be disastrous Memory addresses tend to be very large. The operation above is very likely to lead to overflow Rewrite the function above in order to avoid the overflow

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!