Mega Code Archive

 
Categories / C / Code Snippets
 

Loop and output a char array

#include <stdio.h> int main(void) { char str[80]; int j; printf("Enter a string (less than 80 chars): "); gets(str); for(j = 0; str[j]; j++) printf("%c", str[j]); return 0; }