Question: Write a C function, with appropriate comments to explain how your code works, to scan a null-terminated string and return a pointer to the
Write a C function, with appropriate comments to explain how your code works, to scan a null-terminated string and return a pointer to the first "non-whitespace" character in the string. If the string is entirely whitespace, then return a pointer to the terminating null character. For this exercise, whitespace includes spaces, tabs ('\t'), newlines (' '), and shell-style comments (between "#" and newline). The function prototype should be const char* skipSpaces (const char* buffer); and as an illustrating example, should return the following pointers p for the buffers shown below: " \t 4" buffer p "# All whitespace buffer P " \t # This is a comment # Another # one here \t %#" buffer P You may not call any other functions, except for helper functions you provide. You will lose points for inefficiency (e.g., scanning the string more than once).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
