resolve core dumped when give undefind variable in rc4 function