

Getnstr( users_name, sizeof( users_name ) - 1 ) See Why system() is evil for more information. The following methods are usually supported by a wide variety of platforms, but have significant tradeoffs in functionality or utility or both. If you don't know what that entails, don't worry about it.


If you know yourself to be using just one, you can get rid of everything except for the proper #includes. Throughout this article the code snippits will not assume either C or C++, so the #include section will be bracketed by the appropriate #ifdef tests depending on which language you are using. The difference is that stdio.h is a standard library header for the C language, whereas conio.h has been around since DOS-based versions of the language but is not part of the standard library.This short article describes the method of clearing the console display of all text and positioning the text cursor in the home location (the upper-left corner).īefore becoming too comfortable doing this kind of thing blithely, make sure you read and understand about the types and purposes of console applications (and why it matters).

Conclusionīoth stdio.h and conio.h are headers for the C programming language, used for input and output functions such as printf() and scanf(). This way, you can use your own exit function instead of exiting with 0 (which is normally done). It’s also possible to return an integer value from main() and this value will be stored in eax register when calling exit(). The sum of these two integers is computed by using the + operator, which is defined in. The program uses the function printf() to print a message on the screen and scanf() to read two integers.
• #includeWhen you run the program, enter two numbers separated by space and press return key (Enter key), then the program will display their sum on screen. You can try to compile and run it on your system (including Windows).
