you’ll be needing strncmp
function with string.h
header to compare (check) if the characters Palin( have been entered or use KMP/Needle In The Stack algo to match the strings.
For taking out the content in the ()
from Palin()
in an array say destination[]
:
#include<stdio.h>
#include<string.h>
#define MAX 100
int main()
{
char source[]="palin(hello)";
int len=strlen(src);
char destination[MAX];
memset(destination,0,MAX);
//READ ONLINE ABOUT STRNCPY
strncpy(destination,source+6,len-7);
printf("%s\n",destination);
return 0;
}
OUTPUT:
Hello
7
solved Parsing user input. C [closed]