Friday, July 31, 2009

Program in C to extract a portion of character string and print the extracted string.?

program in C to extract a portion of character string and print the extracted string. assume that m characters are extracted, starting from the nth character.

Program in C to extract a portion of character string and print the extracted string.?
//caution: modifies inbound string param "s"


char *strext(char *s, int n, int m)


{


s[n+m-2] = '\0';


return %26amp;s[n-1];


}





main()


{


char *str = "This is my test string to check the program";


puts(strext(str, 6, 12));


}
Reply:That sounds like a homework assignment. Why don't you TRY IT YOURSELF first, and when you're stuck, post your code so we can comment on it?


No comments:

Post a Comment