Print string character by character

 #include<stdio.h>


int main(){

    // char str[] = "sunil";

    char str[] = {'s', 'u', 'n', 'i', 'l', '\0'};

    char *ptr = str;

    while(*ptr!='\0'){

        printf("%c", *ptr);

        ptr++;

    }

    return 0;

}

Comments

Popular posts from this blog

Snake game.c

Type declaration

Array with function