Discover c scanf format specifiers, include the articles, news, trends, analysis and practical advice about c scanf format specifiers on alibabacloud.com
Printf (), scanf ()
% C --------------- output a character
% D ----------------- output a signed decimal integer
% E (% E) ------------ output a real number of floating-point numbers in the form of normalized exponent. Only 6 digits are
Function Name: scanfFunction: format the input.Usage: int scanf (char * Format [, argument,...]);
The scanf () function is a common terminal formatting input function that reads input information from the standard input device (keyboard. You can
Reprinted from: http://blog.chinaunix.net/u3/99423/showart_2100968.html
I have made many mistakes in the scanf function, and I have also seen mistakes made by others. Remember to remind myself not to repeat the same mistakes. If it is useful to you,
Direct excerpt "C Primer Plus" calculation, too classic, I steal lazy, as a review ~I. OverviewInput from the keyboard is text, because those keys generate text characters: letters, numbers, and punctuation. For example, when you want to enter an
I believe that no matter the great God or the food birds, they recognize printf. And his family and his brother Sprintf,scanf,sscanf...$^&*.when you're gorgeous write down char c='C';p rintf ("char=%d", c), when everything is still so beautiful. But
Some features of scanf and scanfScanf is very sensitive. It is best not to set the accuracy and field width in scanf; otherwise, the input may fail.
Example:
# Include
Int main (void){Int a = 0;Scanf ("% 5d", & );Printf ("a = % d", );Return 0;}
I
Full format of scanf format control:
% * M L or H characters① The format characters are used in the same way as those in the printf function, in the format of % d, % O, % x, % C, % s, % F, % E, no % u format or % G format.② You can specify the
Data type
Constant
Variable
printf Function Introduction
scanf function Introduction
Operator
Data typeThe data type is how the data is stored in memory.There are 5 Big data types in C: Basic type, constructed type, pointer
In fact,%c in the scanf () function is not used to enter a single character, but instead to enter a set of characters.For example:Char a[3];scanf ("%3c", a);Where "3" specifies the width of the input data and, of course, the width is "1",%c can
The function call scanf ("%d", &weight) contains two parameters: "%d" and &weight. c Use commas to separate multiple parameters in a function call;However, the printf () and scanf () functions are special and the number of functions is not
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.