[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Terminal input with scanf

From: Saji Kuttan
Subject: Terminal input with scanf
Date: Thu, 18 Oct 2018 10:49:32 +0530


I want to input multiple column data from terminal that have to be stored into separate variables. I use input and scanf functions for inputting data.

The 'input' command requires the data to be given within square brackets, which I am not interested. So I want to input data without square brackets. The input command stores all data into one variable and not into separate variables.

Then I use the scanf function in the C style. The code is given below.

[a,b]=scanf("%d %f", "C")

in which I ask an integer and float data from the user. Actually, this works well but the scanf waits for one more input from terminal. Why scanf is asking one more input? How to get rid of it? 


Saji P K
Assistant Professor
Department of Physical Oceanography
School of Marine Sciences,
Cochin University of Science and Technology,
Fine Arts Avenue
Kochi - 682016

Phone : (O) 0484 2863206 (Mob) 9744000804
Email : address@hidden
Web :

reply via email to

[Prev in Thread] Current Thread [Next in Thread]