-3

I have a problem in my code. I want to parse a char array to an char pointer; How can i do it?

Example code :

char tmp[1000];
char *temp;

gets(tmp);

How can i parse the char tmp into char *temp?

Regards,

1 Answers1

1

If you mean, to point temp to tmp, this should work.

char tmp[1000];
char *temp;
temp = &tmp[0];

If you want to copy, you may need to do some more work.

Praneeth Peiris
  • 2,008
  • 20
  • 40