In my mind this seems much more easy (look at the comments)
Code:
#include <stdio.h>
int main(void)
{
char* str= "To be or not to be";
char result[7];/*7 because of the null terminator*/
int i;
/*skip characters until you find n*/
while(*str != 'n')
{
*str++;
}
/*copy the requested string*/
for( i = 0 ; i < 6 ; i++)
{
result[i] = *str++;
}
/*do NOT forget the null terminator*/
result[6] = '\0';
printf("Result is %s \n",result);
return 0;
}
I could have declared result as a pointer to and then allocate memory with malloc