From WikiChip
Editing c/basic i/o

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
{{c title|Basic I/O}}
+
{{C Guide}}
One of the most universal things that all programs need is a way to process some input and output the produced results. '''I/O''' stands for '''Input''' and '''Output'''. Input is the data that is sent into the program; output is the data that is sent out of the program. This article covers the basic I/O facilities that the [[C programming language]] provides. This article will only present the simplest forms of I/O operations. For an in-depth overview of I/O, see the {{C|File I/O}} guide.
+
One of the most universal things that all programs need is a way to process some input and output the produced results. '''I/O''' stands for '''Input''' and '''Output'''. Input is the data that is sent into the program; output is the data that is sent out of the program. This article covers the basic I/O facilities that the [[C programming language]] provides. This article will only present the simplest forms of I/O operations. For an in-depth overview of I/O, see the [[File I/O - C|File I/O guide]].
  
 
== Standard streams ==
 
== Standard streams ==
{{main|c/standard streams|l1=standard streams}}
+
{{main|standard streams - C|l1=standard streams}}
In this article, we will cover the basic idea of input and output using the basic {{C|standard streams}}. Standard streams are a set of pre-configured input and output channels, which are automatically available to all C programs. To access these streams, as well as a set of functions to work with them, the only necessary step is to {{C|include directive|include}} the {{C|stdio.h|<stdio.h>}} header file into your program's C source-code.
+
 
 +
In this article, we will cover the basic idea of input and output using the basic [[standard streams - C|standard streams]]. Standard streams are a set of pre-configured input and output channels, which are automatically available to all C programs. To access these streams, as well as a set of functions to work with them, the only necessary step is to [[include directive - C|include]] the [[stdio.h - C|<stdio.h>]] header file into your program's C source-code.
  
 
'''Example'''
 
'''Example'''
Line 177: Line 178:
 
</source>
 
</source>
  
The code above will request the user for two integers. The '''scanf()''' function will attempt to scan and parse two integers separated by a comma, then store the integers at the space pointed to by the arguments (<code>&a</code> means to take the address of a; this concept is explained more in-depth in the {{C|pointers|pointers guide}}). A sample output of the program above might look like this:
+
The code above will request the user for two integers. The '''scanf()''' function will attempt to scan and parse two integers separated by a comma, then store the integers at the space pointed to by the arguments (<code>&a</code> means to take the address of a; this concept is explained more in-depth in the [[pointers - C|pointers guide]]). A sample output of the program above might look like this:
  
 
  Please enter two integers separated by a single comma: 1793,430
 
  Please enter two integers separated by a single comma: 1793,430

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)