Function validate in C