Chapter - 10: Strings

Write a program that extracts part of the given string from the specified position. For example, if the string is "Working with strings is fun", then if from position 4, 4 characters are to be extracted then the program should return string as "king". Moreover, if the position from where the string is to be extracted is given and the number of characters to be extracted is 0 then the program should extract the entire string from the specified position.

int main()
	char sen[100];
	int i;
	printf("Enter your sentence. (Less than 100 chracters)\n\n");
	printf("After how muany characters you want to extract the line : ");
	scanf("%d", &i);
	if (i<0)
		i = 0;
	printf("%s\t", &sen[i]);
	return 0;

© 2021 Garbage Valuegarbage value logo