I need help with this. It has been awhile since I coded in c.

unsigned char test=0x00;				
char tmp[20]; //reserve 20 bytes for string

switch(test)
{
	case 0x00:  tmp="Hello String 0";
	                   break;
	case 0x01:  tmp="Hello String 0";
	                   break;
	case 0x0F:  tmp="Hello String 0";
}

All I want to do is put a string value into a character array variable. Everything that I try just gives me error "incompatible types in assignment".

To copy a string, use strcpy.

Or you can use pointers. Some thing of this sort

int main(int argc, char* argv[])
{
        char *p;

        p="hellow World";
        printf("%s\n",p);
        return 1;
}

works! Thank guys!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.