1 / 7

Basic Input - Output

Basic Input - Output. Output functions. printf() – is a library function that displays information on-screen. The statement can display a simple text message or a message and the value of one or more program variables gotoxy() – positions the cursor on a specific location on the screen

savea
Download Presentation

Basic Input - Output

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic Input - Output

  2. Output functions • printf() – is a library function that displays information on-screen. The statement can display a simple text message or a message and the value of one or more program variables • gotoxy() – positions the cursor on a specific location on the screen • clrscr() – clears the screen and place the cursor at the upper left hand portion of the screen

  3. Input functions • scanf() – reads data from the keyboard according to a specified format and assigns the input data to one or more program variables. For numeric variables, the address can be passed by the address of operator, the ampersand (&) that is placed at the beginning of the variable name. • getch() / getche() – gets a character from the keyboard. It waits until a key is pressed and then returns the inputted character to the calling function. Unlike the scanf() function, getch/e() does not wait for the carriage return key to be pressed. The difference between the getch() and getche() is that the latter echoes the typed character to the screen.

  4. Escape Sequences • \r carriage return • \n newline • \t move to the next tab • \a beep the speaker • \b backspace • \’ prints single quote • \” prints double quote • \\ prints backslash character • \xdd prints character whish is in hexadecimal form

  5. Format Specifier • %c character • %s string • %d integer • %f float • %e exponential • %x hexadecimal • %o octal • %ld long integer • %lf long float / double precision

  6. Declaration of Variables • A variable is a named data storage location in your computer’s memory. Variables in C can contain letters, digits and the underscore character ( _ ). It should be remembered that C language is case sensitive; two similar words in different cases generate two different variables. • A variable declaration tells the compiler the name and type of a variable and optionally initializes the variable to a specific value. When a variable is declared, the compiler sets aside a storage space for the variable.

More Related