Subscribe Us

Responsive Advertisement

Advertisement

SUBSTRING IN C WITHOUT BUILT IN FUNCTION

 

SUBSTRING IN C WITHOUT BUILT IN FUNCTION




#include<stdio.h>

void sub(char b[],int nu,int le){

         char c[le+1];

         int i,j;

           //printf("%d\n",strlen(c));

         for(i=nu-1,j=0;j<le;i++,j++)

         {

             c[j]=b[i];


         }

         c[j]='\0';

     printf("%s\n",c);


}

int main()

{

    char s[100];

    gets(s);

    int n,l;

    scanf("%d%d",&n,&l);

    sub(s,n,l);



}




Post a Comment

0 Comments