Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help with this string argument. Thanks somuch. Will rate as lifesaver. Wr

ID: 3615626 • Letter: P

Question

Please help with this string argument. Thanks somuch. Will rate as lifesaver. Write a program and the function hydroxide that returns 1for true if its string argument ends in the substring OH.Use the string function strcmp to check for "OH".
Hint: create a substring for your comparison from the originalstring input by the user.
Use the following data to test you program:
KOH H202 NaCl NaOH
Please help with this string argument. Thanks somuch. Will rate as lifesaver. Write a program and the function hydroxide that returns 1for true if its string argument ends in the substring OH.Use the string function strcmp to check for "OH".
Hint: create a substring for your comparison from the originalstring input by the user.
Use the following data to test you program:
KOH H202 NaCl NaOH

Explanation / Answer

please rate - thanks #include #include #include int hydroxide(char[]); int main() {int yes; char chem[8]; printf("Enter chemical compound:(done to exit) "); scanf("%s",&chem); while(strcmp(chem,"done")!=0) {if(hydroxide(chem)==0)     printf("%s is an hydroxide ",chem); else      printf("%s is not anhydroxide ",chem); printf("Enter chemical compound:(done to exit) "); scanf("%s",&chem); } return 0; } int hydroxide(char chem[]) {int len; char temp[3]; len=strlen(chem); temp[2]=''; strncpy(temp,chem+len-2,2); return(strcmp("OH",temp)); }