void printStr(char str[]) { int i=0; while(str[i]!='\0') { printf("%c", str[i]); i++; } printf("\n"); } int main() { // char str[] = {'h', 'a', 'r', 'r', 'y', '\0'}; // char str[6] = "harry"; char str[34]; gets(str); printf("Using custom function printStr\n"); printStr(str); printf("Using printf : %s\n", str); printf("using puts: \n"); puts(str); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter