answersLogoWhite

0

Because it is not safe. Scanf puts the data into a buffer. There is no size checking so the data may be larger than the buffer causing a buffer overrun with undefined (usually bad but always undesirable) behavior.

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

Difference between cin and scanf?

the getchar function waits the user hit a key followed by return key. Upon the return key hitted by the user the function returns the key. But the scanf can be used for various & different user entered data including text, integer, float and so on. in spite of getchar the delimeter keys for scanf function are tab, space and return key; so when a space entered by the user in the input the scanf will end the input and waits user enter the return key. You must take in mind that just the fragment of input that is behind these delimeters will be considered as legal input for the scanf and the remaninder will be escaped.


What is the difference between binary file and text file in java?

HI... When you access a file from within C or C++ you have a choice between treating the file as a binary file or as a text file. C uses the fopen(file,mode) statement to open a file and the mode identifies whether you are opening the file to read, write, or append and also whether the file is to be opened in binary or text mode. C++ opens a file by linking it to a stream so you don't specify whether the file is to be opened in binary or text mode on the open statement. Instead the method that you use to read and/or write to the file determines which mode you are using. If you use the operator to write to the file then the file will be accessed in text mode. If instead you use the put() and get() or read()and write() functions then the file will be accessed in binary mode. So what exactly is the difference between text and binary modes? Well the difference is that text files contain lines (or records) of text and each of these has an end-of-line marker automatically appended to the end of it whenever you indicate that you have reached the end of a line. There is an end of line at the end of the text written with the C fwrite() function or in C++ when you


Difference between write and writeln in javascript?

write() will just be a line of text and writeln() will be a line of text that puts the next writeln() on another line


Is text alignment important?

not really It is if you wish it to be easily read


What text maintains its original line breaks and spacing?

To maintain the original formatting of text, including line breaks and spacing, you can use the PRE tags. You simply surround the text with the PRE element, and the text will be display in whatever way it's been typed. <pre> Text formatted like you want. </pre>

Related Questions

In order to stay focused when reading a long page of text you can?

read only one sentence or line of text at a time.


Does this hand-held scanner offer both text recognition and photographic imaging functions?

No, it doesn't. It will actually read bar codes and text, but that's all that it will do.


How do you read Hebrew text from right to left?

To read Hebrew text from right to left, start at the right side of the page or screen and move towards the left as you read each line of text. The direction of reading in Hebrew is opposite to English, which reads from left to right.


Difference between cin and scanf?

the getchar function waits the user hit a key followed by return key. Upon the return key hitted by the user the function returns the key. But the scanf can be used for various & different user entered data including text, integer, float and so on. in spite of getchar the delimeter keys for scanf function are tab, space and return key; so when a space entered by the user in the input the scanf will end the input and waits user enter the return key. You must take in mind that just the fragment of input that is behind these delimeters will be considered as legal input for the scanf and the remaninder will be escaped.


Why do you need line spacing?

In order for lines of text to be read, they cannot all be written on top of each other, so they need to be spaced out. Line spacing determines how much space is between each line of text. The standard is for each line to be immediately below the previous one, as you would see in this answer. Sometimes you want more spacing. This could be to make things easier to read, or because there is not a long of text on a page and it looks better if it takes up more of the page. Commonly you may have double line spacing, which is text on every second line.


What is the significance of line spacing in books and how does it impact the reading experience?

Line spacing in books is significant as it affects readability and comprehension. Proper line spacing can make text easier to read by reducing eye strain and improving focus. It also helps with the flow of the text and allows for better organization of information on the page. In contrast, inadequate line spacing can make text appear cluttered and difficult to read, leading to a less enjoyable reading experience.


What Grammy Award winner features in the tribute tee?

Im guessing this is for Sugars competition. READ the text. Its in there, no one will know this unless they read the text. Im guessing this is for Sugars competition. READ the text. Its in there, no one will know this unless they read the text. Im guessing this is for Sugars competition. READ the text. Its in there, no one will know this unless they read the text. Im guessing this is for Sugars competition. READ the text. Its in there, no one will know this unless they read the text.


Why you use scanf?

scanf is a function that reads data with specified format from a given string stream source, originated from C programming language, and is present in many other programming languages.The scanf function prototype is:int scanf(const char *format, ...);The function returns the total number of items successfully matched, which can be less than the number requested. If the input stream is exhausted or reading from it otherwise fails before any items are matched, EOF is returned.So far as is traceable, "scanf" stands for "scan format", because it scans the input for valid tokens and parses them according to a specified format.UsageThe scanf function is found in C, in which it reads input for numbers and other datatypes from standard input (often a command line interface or similar kind of a text user interface).The following shows code in C that reads a variable number of unformatted decimal integers from the console and prints out each of them on a separate line:#include intmain(void){int n;while (scanf("%d", &n) 1)puts(word);return 0;}No matter what the datatype the programmer wants the program to read, the arguments (such as &nabove) must be pointers pointing to memory. Otherwise, the function will not perform correctly because it will be attempting to overwrite the wrong sections of memory, rather than pointing to the memory location of the variable you are attempting to get input for.As scanf is designated to read only from standard input, many programming languages with interfaces, such as PHP, have derivatives such as sscanfand fscanf but not scanf itself.


What is the name of the spacing between the text of a paragraph that helps control the readability of the text called?

The spacing between the text of a paragraph that helps control readability is called "line spacing" or "leading." It refers to the vertical distance between lines of text, which can significantly impact how easily the text can be read. Proper line spacing enhances clarity and prevents the text from appearing cramped or overwhelming.


What does it mean to set text line for line?

Set text line for line is a common phrase in design. This means that you set a default text to the baseline. This can be applied on a document that does not have a text frame.


Do you read Arabic left to right?

Yes, Arabic is read from right to left. Each line of text starts on the right side and progresses towards the left.


Why is it easier to read color text than it is to read black text?

It is not.