Question: void correctfield( char* fld, char* corrected ) This function must correct a field that is not a phone number.Doing this in-place is unpleasant, so we

void correctfield( char* fld, char* corrected )

This function must correct a field that is not a phone number.Doing this in-place is unpleasant, so we copy the field tocorrected while correcting it. The function removes spaces from thebeginning and from the end, replaces repeated spaces by a singlespace, and replaces other whitespace characters (such as TAB) byspaces. You may assume that corrected is large enough to hold theresult.

void correctPhoneNumber( char* number, char* corrected )

This function must correct a phone number. This cannot be donein place, because the number may get longer when it doesn’t startwith + or two zeroes. This function must do the folowing: If thenumber starts with two zeroes, they must be replaced by a single +.If the number does not start with two zeroes, or a +, it mustinsert a + at the beginning. After that, it must copy all digits tothe corrected number, replace letters by digits, and ignoreeverything else. You may assume that corrected is large enough tohold the result. Dealing with the letter codes is a bit unpleasant.We recommend to do it as follows: Use isalpha( ) to recognizeletters, use tolower( ) to make the letter lower case. After that,use a switch statement. If you want you can put it in a separatefunction USAcode( char ). It is a bit unpleasant to type out allcases but any attempt to do it smarter will result in less readablecode.

Please write those functions in C language

Step by Step Solution

3.36 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer 1 void correctField char fld char corrected int i 0 int j 0 remove beginning and ending space... View full answer

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 Electrical Engineering Questions!