<p>Write a function thats called trimfrnt() that deletes all leading blanks from
ID: 3637416 • Letter: #
Question
<p>Write a function thats called trimfrnt() that deletes all leading blanks from a string. write this function using pointers with the return type void. The solution I come up with listed below, states I have an error in my programming?!? I’m having issues finding the error, please assist me, thanks…</p><p> </p>
<p>#include <iostream></p>
<p>using namespace std;</p>
<p>void trimfrnt(char *strng);</p>
<p>int main()</p>
<p>{</p>
<p>int i = 0;</p>
<p>int len = 0;</p>
<p>len = strlen(strng);</p>
<p>i = len - 1;</p>
<p>while (*(strng + i) && *(strng + i) == ' ')</p>
<p>i--;</p>
<p>len = i + 1;</p>
<p>*(strng + len) = '';</p>
<p>return;</p>
<p>}</p>
Explanation / Answer
#include using namespace std; void trimfrnt(char *strng); int main() { int i = 0; int len = 0; len = strlen(strng); i = len - 1; while (*(strng + i) && *(strng + i) == ' ') i--; len = i + 1; *(strng + len) = ''; return; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.