You cold use a pin configured for input and output. If required with an additional output enable. When using the pin as input set the output to high-z.
Thanks for your quickly response.
What if I need to change pin type among Analog,Digital input and Digital Output? will it go wrong in hardware if I configure all?
Do it, it works!