请编写函数mygets和myputs,其功能分别与gets和puts相同,函数中用getc...
include<stdio.h> void main(void) { char *input(char*); int output(char*); char str[80]; input(str); output(str); return; } char *input(char *str) { int i; char ch; for(i=0;(ch=getchar())!='\\n';i++) str[i]=ch; str[i]='\\0'; retu...
c语言中请编写函数mygets和myputs,其功能分别与gets与puts相同,函数中...
include <stdio.h> char *mygets(char str[]) {int ch,i = 0;while(1) {ch = getchar();if(ch == -1) return NULL;if(ch == '\\n') {str[i] = '\\0';break;}str[i] = ch;++i;}return str;}int myputs(char *str) {int i,retval,cnt = 0;for(i = 0; str[i]...
用C语言:写一个函数,将两个字符串连接
='\\0'){ a[i++]=b[j++];} a[i]='\\0'; }int main(){char a[100],b[100];gets(a);gets(b);mystrcat(a,b);puts(a); return 0;}\/*运行结果:abcdefabcdef*\/