I'm trying to find out what are the first and second characters in the string. I have a character array token[1] where each index contains a separate string. I want to look inside token[1] for the characters. My idea was to copy token[1] into dir[]. Is this logic correct? If not can you please advice. In this example, I'm trying to copy a string (e.g. "hi") located in token [0] into another array, dir, so that I can later traverse through dir to find specific characters.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char *tokens[513];
char *dir;
tokens[0] = "Hi";
strcpy(dir, tokens[1]);
printf("message: %s" , tokens[0]);
}
or is there a way to directly look into tokens? Please help!