c语言putchar函数_C语言中的putchar()函数与示例

c语言putchar函数

C语言中的putchar()函数 (putchar() function in C)

The putchar() function is defined in the <stdio.h> header file.

putchar()函数在<stdio.h>头文件中定义。

Prototype:

原型:

    int putchar(const char *string);

Parameters: const char *string

参数: const char * string

Return type: int

返回类型: int

Use of function:

使用功能:

In the file handling, through the putchar() function, we take the character to the stream stdout and store them into the specified string array. The prototype of the function putchar() is int putchar(const char *string);

在文件处理中,通过putchar()函数 ,我们将字符带到流stdout并将其存储到指定的字符串数组中。 函数putchar()原型是int putchar(const char * string);

The character which is read is an unsigned char which is converted to an integer value. In the case of file handling, it returns EOF when end-of-file is encountered. If there is an error then it also returns EOF.

读取的字符是无符号字符 ,该字符将转换为整数值。 在文件处理的情况下,遇到文件结尾时它将返回EOF 。 如果有错误,则它还会返回EOF 。

C语言中的putchar()示例 (putchar() example in C)

#include <stdio.h>
#include <stdlib.h>
int main(){
//Initialize the character array
char str[100];
int i=0,j=0;
printf("Enter the string into the file\n");
//takes all the characters until enter is pressed
while((str[i]=getchar())!='\n'){
//increment the index of the character array
i++;
}
//after taking all the character add 
//null pointer at the end of the string
str[i]='\0';
printf("\nThe file content is - ");
//loop is break when null pointer is encountered
while(str[j]!='\0'){
//print the characters
putchar(str[j]);
j++;
}
return 0;
}

Output

输出量

putchar() example in C language

翻译自: https://www.includehelp.com/c-programs/putchar-function-in-c-language-with-example.aspx

c语言putchar函数

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/545413.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

算法复习第六章第七章

算法复习第六章第七章第六章回溯法TSP问题0-1bag问题图着色问题八皇后问题第七章分支限界法0-1bag问题TSP问题第六章回溯法 TSP问题 0-1bag问题 图着色问题 八皇后问题 第七章分支限界法 0-1bag问题 TSP问题

扫描识别系统

扫描识别系统&#xff0c;是指能够利用扫描仪进行扫描的相关文件&#xff0c;比方普通文档&#xff0c;政府公文&#xff0c;二代身份证&#xff0c;条码……等等。通过扫描仪扫描后不单单生成常见的JPG&#xff0c;PDF等格式的图像。而是利用先进的OCR技术&#xff0c;进行相关…

转:ORA-01126: 数据库必须已装载到此实例并且不在任何实例中打开

转载&#xff1a;http://www.worlduc.com/blog2012.aspx?bid19973952 alter database archivelog 2 ; alter database archivelog * 第 1 行出现错误: ORA-01126: 数据库必须已装载到此实例并且不在任何实例中打开 ------最佳解决方案-------------------- 修改归档模式的…

Java SimpleTimeZone setStartRule()方法与示例

SimpleTimeZone类setStartRule()方法 (SimpleTimeZone Class setStartRule() method) Syntax: 句法&#xff1a; public void setStartRule(int st_mm, int st_dd, int st_time);public void setStartRule(int st_mm, int st_dd, int st_dow, int st_time);public void setSta…

实战:Redis 性能优化方案

Redis 是基于单线程模型实现的,也就是 Redis 是使用一个线程来处理所有的客户端请求的,尽管 Redis 使用了非阻塞式 IO,并且对各种命令都做了优化(大部分命令操作时间复杂度都是 O(1)),但由于 Redis 是单线程执行的特点,因此它对性能的要求更加苛刻,本文我们将通过一些优…

Python正则表达式指南上半部

本文介绍了Python对于正则表达式的支持&#xff0c;包括正则表达式基础以及Python正则表达式标准库的完整介绍及使用示例。本文的内容不包括如何编写高效的正则表达式、如何优化正则表达式&#xff0c;这些主题请查看其他教程。注意&#xff1a;本文基于Python2.4完成&#xff…

算法复习第三章分治法

算法复习第三章分治法循环日程表最近点对快速排序&#xff1a; 循环日程表 最近点对

Oracle 的 char number varchar2 效率测试

自己在建表的时候&#xff0c;用到了编号的这个字段&#xff0c; 主要问题是要用java连接数据库&#xff0c;所以要有pojo类&#xff0c; 就像 编号 这种字段&#xff0c;int 不够&#xff0c;long 转起来麻烦&#xff0c;还容易出错。 突然想看看char可不可以&#xff0c;所…

实战:Redis 慢查询

Redis 慢查询作用和 MySQL 慢查询作用类似,都是为我们查询出不合理的执行命令,然后让开发人员和运维人员一起来规避这些耗时的命令,从而让服务器更加高效和健康的运行。对于单线程的 Redis 来说,不合理的使用更是致命的,因此掌握 Redis 慢查询技能对我们来说非常的关键。 …

Java SecurityManager checkAccess()方法与示例

Syntax: 句法&#xff1a; public void checkAccess (Thread th);public void checkAccess (ThreadGroup tg);SecurityManager类的checkAccess()方法 (SecurityManager Class checkAccess() method) checkAccess(Thread th) method is called for the current security manage…

算法复习第四章动态规划

算法复习第四章动态规划动态规划TSP问题0-1bag动态规划 TSP问题 0-1bag 最长公共子序列不考&#xff1a;

4. 星际争霸之php设计模式--工厂方法模式

题记本php设计模式专辑来源于博客(jymoz.com)&#xff0c;现在已经访问不了了&#xff0c;这一系列文章是我找了很久才找到完整的&#xff0c;感谢作者jymoz的辛苦付出哦&#xff01; 本文地址&#xff1a;http://www.cnblogs.com/davidhhuan/p/4248177.html PHP手册上提到的工…

Oracle 建立序列以及触发器的建立

笔记系列 序列&#xff1a;序列的创建方法&#xff0c;以及插入数据时的使用&#xff1b; --序列的创建 create sequence sq increment by 1 start with 1 maxvalue 10 minvalue 1 cycle cache 5--一般(一个序列可以用在多张表&#xff0c;但是一般情况下&#xff0c;一张表对应…

实战:Redis 性能测试

为什么需要性能测试? 性能测试的使用场景有很多,例如以下几个: 技术选型,比如测试 Memcached 和 Redis;对比单机 Redis 和集群 Redis 的吞吐量;评估不同类型的存储性能,例如集合和有序集合;对比开启持久化和关闭持久化的吞吐量;对比调优和未调优的吞吐量;对比不同 R…

操作系统Ubuntu(实验三四)

实验三四3._实验三&#xff1a;Linux进程/线程的异步并发执行3.1_fork()函数创建子进程3.2_创建线程pthread_create();4._实验四&#xff1a;使用信号量进行互斥与同步4.1_信号量初使用&#xff08;1&#xff09;信号量简单介绍&#xff08;2&#xff09;信号量以及P、V操作的使…

Java RandomAccessFile writeShort()方法与示例

RandomAccessFile类writeShort()方法 (RandomAccessFile Class writeShort() method) writeShort() method is available in java.io package. writeShort()方法在java.io包中可用。 writeShort() method is used to write the short value to the file as 2 bytes directly wi…

js中cookie的使用详细分析

cookie概述 cookie 是浏览器提供的一种机制&#xff0c;它将document 对象的cookie属性提供给JavaScript。可以由JavaScript对其进行控制&#xff0c;而并不是JavaScript本身的性质。cookie是 存于用户硬盘的一个文件&#xff0c;这个文件通常对应于一个域名&#xff0c;当浏览…

实战:Redis哨兵模式(上)

上一篇我们讲了主从复制模式,它是属于 Redis 多机运行的基础,但这种模式本身存在一个致命的问题,当主节点奔溃之后,需要人工干预才能恢复 Redis 的正常使用。 例如,我们有 3 台服务器做了主从复制,一个主服务器 A 和两个从服务器 B、C,当 A 发生故障之后,需要人工把 B…

Oracle plsql 打包

--打包 --创建包 --步骤&#xff1a; --1、声明&#xff08;创建包头&#xff09; --2、创建数据对象&#xff08;创建包体&#xff09;--1、 create or replace package myPack asv_bookCount integer;procedure p_back(v_stuid borrow.stuid%type,v_bid borrow.bid%type);fun…

计算机网络(第四章网络层)

第四章网络层4.1_网络层提供的两种服务&#xff08;1&#xff09;虚电路服务&#xff08;2&#xff09;数据报服务4.2_网络协议4.2.1_虚拟互连网络4.2.2_分类的IP地址&#xff08;1&#xff09;分类IP地址三种分类方法IP 地址的一些重要特点4.2.3_IP地址与硬件地址4.2.4_地址解…