What are the input and output statements in C language?

青灯夜游
Release: 2020-11-03 11:25:53
Original
36377 people have browsed it

The input and output statements of C language include: "getchar(void);" and "putchar(int c);", "scanf("format control string", address list);" and "printf( "Format control string ", output list);", "gets()" and "puts()" and so on.

What are the input and output statements in C language?

Tutorial recommendation: "c language tutorial video"

1: Console input Output

(1) Input/output of character data

Character outputputchar(int c);

Character inputgetchar(void);

(2) Formatted input/output

Format outputprintf("Format control string", output list);

Format inputscanf("Format control string", address list);

(3) String input/output

String outputputs(const char *str);

String inputgets(char *str);

scanf cannot accept spaces, Tab, carriage return, etc.; processing of the carriage return character at the end: keep the carriage return character in the cache.

gets can accept spaces, tab characters, carriage returns, etc.; the processing of the carriage return character at the end: accept the carriage return, but replace the carriage return with \0.

2: Reading and writing files

(1) Read and write a character

Character writing functionfputc (c,fp);

Character reading functionfgetc(fp);

(2)Block reading and writing

Binary writing functionfwrite(buffer,size,count,fp);

Binary read functionfread(buffer,size,count,fp);

Format Formatted writing functionfprintf (file pointer, format string, output item list);

Formatted reading functionfscanf (file pointer, format string, address parameter list) ;

(3) Other reading and writing functions

Disk file writing functionputw(10,fp);

Disk file reading functiongetw(fp);

File string writing functionfputs(string, file pointer);

File string reading functionfgets (string array name, n, file pointer);

For more programming-related knowledge, please visit:Programming Learning Website! !

The above is the detailed content of What are the input and output statements in C language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!