If you give the declaration statement of myarray it will easy to say answer.

And you can check whether myarray[0] it is NULL or empty string.
or try to print what value myarray contains.

Code:
// If it is a pointer you can check like this.
if(myarray[0]!=NULL && strcmp(myarray[0],"cd") == 0) 
{
	chdir(myarray[1]);
}