MCQOPTIONS
Saved Bookmarks
| 1. |
Which of the following function is correct that finds the length of a string? |
| A. | int xstrlen(char *s) { int length=0; while(*s!='\0') { length++; s++; } return (length); } |
| B. | int xstrlen(char s) { int length=0; while(*s!='\0') length++; s++; return (length); } |
| C. | int xstrlen(char *s) { int length=0; while(*s!='\0') length++; return (length); } |
| D. | int xstrlen(char *s) { int length=0; while(*s!='\0') s++; return (length); } |
| Answer» B. int xstrlen(char s) { int length=0; while(*s!='\0') length++; s++; return (length); } | |