answersLogoWhite

0

What is the purpose of the scanf function?

Updated: 9/17/2019
User Avatar

Wiki User

12y ago

Best Answer

The scanf() function reads formatted input from stdin according to a format string and assigns the data to specified variable(s). The input data is a character sequence which is converted to the appropriate type, as per the format string, before being assigned to the corresponding variable.

Examples:

unsigned x;

scanf("%u", &x);

In the above example, we read an unsigned integer (%u) from the stdin character stream and assign the resultant value to the variable x.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the purpose of the scanf function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What happens by the scanf statement in c?

It's a function, not a statement. Use your help system to find out its purpose.


Can you use scanf function within printf function?

Yes: double d; printf ("scanf's just returned %d\n", scanf ("%lf", &d));


Why not use the ampression symbol in scanf statement in function?

scanf is a function, not a statement. Example: int a; char name[12]; scanf ("%d %s", &a, &name[0]);


What is the syntax of scanf?

scanf: scanf is a built-in function to read input from the user.


What are the header file of scanf function?

stdio.h


Scanf function in c for strings?

Use '%s', eg: char name[64]; scanf ("%s", name);


What is scanF function?

scanf() is an input function which reads input from the standard input devices such as keyboard. Syntax: scanf("Control Character",address_list); where control character is a sequence of one or more character such as %d,%f,%lf,%lld. Address list specifies the variables, pointers etc. e.g. scanf("%d",&num);


What is return type of scanf function?

Use the help/manual.


What is the purpose of scanf in c language?

scanf is used for reading formatted data from stdin. The general syntax is:scanf( format , arguments);For more information on scanf, visit the link below.


Is there a function similar to the C plus plus scanf function in JavaScript?

Scanf is part of the C standard library. Although the C++ standard library includes 18 headers from the ISO C90 standard, their usage in C++ is deprecated. However, to answer the question, there is no equivalent to scanf in JavaScript.


What is the use of printf and scanf function?

Printf prints something to the standard output stream, and scanf inputs something from the standard input stream.


Which function is used to read data from the console?

The scanf() function in the <stdio.h> C standard library header.