simple code using pointers