Designing String Tokenizer

I’am not getting any output.
#include
#include
#include
using namespace std;
char *mystrtok(char str,char delim)
{
static char
input=NULL;
if(str!=NULL)
{
input=str;
}
//Base Case
if(input=NULL)
{
return NULL;
}
// Start extracting tokens and store them in an array
char *output=new char[strlen(input)+1];
int i=0;
for( ;input[i]!=’\0’;i++)
{
if(input[i]!=delim)
{
output[i]=input[i];
}else{
output[i]=’\0’;
input=input+i+1;
return output;
}
}
//corner case
output[i]=’\0’;
input=NULL;
return output;
}

int main()
{
char s[100]=“Today is a rainy day”;
char *ptr=mystrtok(s,’ '); // strtok() is an inbuilt function
cout<<ptr<<endl;

while(ptr!=NULL)
{
	ptr=mystrtok(NULL,' '); //It maintains the state of string internally
	cout<<ptr<<endl;
}
return 0;

}

here you have done a common mistake of using assignment operator (=) instead of comparison operator(==)

correct statement

if(input==NULL)
{
return NULL;
}

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.