I was coding a program to find the longest common sub-sequence today and i was getting the elements of the each sequence into a character array. but i ran into a little problem. i used a for loop to get the elements but not matter how high i set the number of iterations the loop should execute it always terminated after 5 iterations. The array into which the data was being input was an array of size 10 so there were no issues with the array size. I coded a small test program to check and even in the test program the for loops that get data for a character array always terminate after 5 iterations . Can someone tell me why ?( i am forced to use turbo c++ in my lab)

sigh at least try to compile the code before you post it. also, the loop definitely doesn't terminate after 5 iterations, you should have put some trace message there to see it :/
–
Karoly HorvathSep 23 '11 at 14:02

ok i did compile it. and i tried displaying i after ever scanf statement. but it just kept incrementing twice .
–
Srinivas SureshSep 23 '11 at 14:06