I've used strtok() before to parse a string, but for some reason I cannot seem to use it in separate functions correctly. I'm trying to separate strings in one function and initialize them in the calling function. Can someone tell me where I'm going wrong?
Code:
void get_tokens(char *line, char *lbl, char *opertr, char *opernd){
lbl=strtok(line, " ");
opertr = strtok(NULL, " ");
opernd = strtok(NULL, " ");
}
void pass1(){
char inp_line[INP_LENGTH + 1],
label[NAME_LENGTH + 1],
oper[OP_LENGTH + 1],
opnd[OPND_LENGTH + 1];
get_tokens(inp_line, label, oper, opnd);
}