use struct pointer in functions