April 19th, 2013, 06:33 AM
Join Date: Apr 2013
Time spent in forums: 23 m 51 sec
Reputation Power: 0
Input few numbers in an integer array
I want to input few numbers in an array but don't know pre-hand how many elements would be inputted.
So the loop should basically run till the user is still inputting.
Example :- There are 2 arrays A & B.
A - 1,2,3,4,5
B - 2,2,6,7,9
So far, I have tried lots of things as follwing but all in vain - >
While(input = scanf("%d",&A[i]))
if(input == '\n')
Similar loop for array B.
Then I tried using the scanf("%[\n],&A[i]) as well but didnt get what I needed.