String tokenizer code shows error

#include
#include
#include
using namespace std;

char *mystrtok(char s[],char del)
{
static char *input=NULL;
if(s!=NULL)
{
input=s;
}

if(input==NULL)
    return NULL;

char *output=new char[strlen(input)+1];

int i;
for(i=0;input[i]!='\0';++i)
{
    if(input[i]!=del)
    {
        output[i]=input[i];
    }
    else
    {
        output[i]='\0';
        input=input+i+1;
        return output;
    }

    output[i]='\0';
    input=NULL;
    return output;
}

}
int main()
{
char s[]=“hello i am atul good morning”;

char *ptr;

ptr=mystrtok(s," ");
cout<<ptr;

while(ptr!=NULL)
{
    cout<<ptr<<endl;
    ptr=mystrtok(NULL," ");
}
return 0;

}

Hey @aattuull
In your mystrtok function:

char *mystrtok(char s[],char del)
The second argument should be a char but in the following lines, you’re passing a string " " instead of a character :
ptr=mystrtok(s," “);
ptr=mystrtok(NULL,” ");

So the above lines should be written as:
ptr=mystrtok(s,’ ‘);
ptr=mystrtok(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.