1 min Reading
1 Comment
C Programming
C Programs
Code, Tutorial and Tricks & Tips
#include <stdio.h> int main() { char string[1000], sub[1000]; int position, length, c = 0; printf("Input a string\n"); gets(string); printf("Enter the position and length of substring\n"); scanf("%d%d", &position, &length); while (c < length) { sub[c] = string[position+c-1]; c++; } sub[c] = '\0'; printf("Required substring is \"%s\"\n", sub); return 0; }
Input a string
c programming
Enter the position and length of substring
3
11
Required substring is "programming"
1 comments
Good
ReplyDeleteHere is blog for basic C and C++ programs
List of C and C++ Programs
blog link
C and C++ based programs