Substring from a position to length - C Language Programming

Program in C Language to substring from a position to length

Click here to open this program in Turbo C++

 Statement - Substring from a position to length
 Programmer - Vineet Choudhary
 Written For -

#include <stdio.h>
#include <conio.h>

void main()
    char string[1000], sub[1000];
    int position, length, c = 0;
    printf("Input a string\n");
    printf("Enter the position and length of substring\n");
    scanf("%d%d", &position, &length);
    while (c < length) {
        sub[c] = string[position+c-1];
    sub[c] = '\0';
    printf("Required substring is \"%s\"\n", sub);
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.