i am using a switch kind of structure in my program..it wont help in my case....i mean it will but i will have to keep checking for this key press...it will make my program very lenghty....isnt there any other alternative
Nope, technically something is ALWAYS checking the keyboard for input as part of what is known as the "Control Loop". It is actually easier to do this with the operating systems API then it is on console.