Q:

Print a string using a loop

0

Print a string using a loop

We can print a string using a loop by printing its characters one at a time. It terminates with '\0' (NULL character), which marks its end.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>
int main()
{
   char s[100];
   int c = 0;

   gets(s);

   while (s[c] != '\0') {
      printf("%c", s[c]);
      c++;
   }

   return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now