बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

Showing posts with label C simple program substring. Show all posts
Showing posts with label C simple program substring. Show all posts

C simple program to extract substring from a given string

simple program to extract sub string from a given string


#include
#include
#include

void extract(char *,char *,char *,int,int);
void main()
{

char s[50]="working with strings is fun";
char t[50];
char d[50];
intpos,len;

printf("enter the position and length to be extracted= ");
scanf("%d%d",&pos,&len);


printf("\n\n");
extract(s,t,d,pos,len);
puts(d);
getch();
}
void extract(char *s,char *t,char *d,intpos,intlen)
{

s=s+(pos-1);
t=s+len;
while(s!=t)
{
*d=*s;
s++;
d++;
}
*d='\0';


}


C simple program substring,simple string program in c,c simple program example,c simple program with output,c simple program pdf

C Program example List