one error i could myself rectify later was tat i wasnt implementing stacks completly...i.e my top pointer was pointing somewhere else...when i rectified it the code works properly for 2 variables but not for 3 and higher....the above code *isnt* the modified one....