Link to home
Start Free TrialLog in
Avatar of larockd
larockd

asked on

Input Of an Unspecified Amount From a User

I am working on a project where the user enters in an unspecified amount of integers.  I havent came up with a good solution.

I can have the user enter the integers using scanf.  Scanf returns the amount of items entered I can use this to determine how much memory to allocate with malloc.  The problem is does scanf only count the valid data
(integers as opposed to characters?).  How would I handle if a character was in the mix of integers?


Am I headed in the right direction on this or does anyoen have a much better way of handling this.

Thanks
Darrell
ASKER CERTIFIED SOLUTION
Avatar of dotand
dotand

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ozo
What do you want to happen if a character was in the mix of integers?