Printing from to (or) making slice function

 #include<stdio.h>

void slice(char *st, int m, int n){

    int i = 0;

     while((m+i)<n){

         st[i] = st[i+m];

         i++;

     }

     st[i] = '\0';

}


int main(){

    char st[] = "sunilkumartdgrfg";

    slice(st, 1, 6);

    printf("%s", st);

    return 0;

}

Comments

Popular posts from this blog

Snake game.c

Type declaration

Array with function