Write a c program to extract a portion of a character string and print the extracted string. Assume that m characters are extracted, starting with nth character

Write a c program to extract a portion of a character string and print the extracted string. Assume that m characters are extracted,  starting with nth character


#include<stdio.h>
#include<conio.h>
int main()
{
    char a[50],b[50];
    int s,m,i,p=0;
    printf("Please Enter String:= ");   
    gets(a);
    printf("Enter Start point for Extract:= ");
    scanf("%d",&s);
    printf("How many characters are extracted:= ");
    scanf("%d",&m);
    for(i=s;i<m+s;i++)
        b[p++]=a[i];
    b[p]='\0';
    puts(b);
    getch();
}



Next Post Previous Post
No Comment
Add Comment
comment url