Store current value , to be printed later , after printing left and right subtrees . Increment preIndex to find left and right subtrees , and pass this updated value to recursive calls .
int val = pre [ preIndex ] ; preIndex ++ ;