1.

Which of the following function is correct that finds the length of a string?

A. <pre><code class="cpp">int xstrlen(char *s) { int length=0; while(*s!=' 0') { length++; s++; } return (length); } </code></pre>
B. <pre><code class="cpp">int xstrlen(char s) { int length=0; while(*s!=' 0') length++; s++; return (length); } </code></pre>
C. <pre><code class="cpp">int xstrlen(char *s) { int length=0; while(*s!=' 0') length++; return (length); } </code></pre>
D. <pre><code class="cpp">int xstrlen(char *s) { int length=0; while(*s!=' 0') s++; return (length); } </code></pre>
Answer» B. <pre><code class="cpp">int xstrlen(char s) { int length=0; while(*s!=' 0') length++; s++; return (length); } </code></pre>


Discussion

No Comment Found