知识基础:


函数定义


字符数组和字符串


答案

#include<stdio.h>
char fun(char a[],char b[]);
char fun(char a[],char b[]){
	printf("%s%s",a,b);
	return 0;
}
int main(){
	char a[10],b[10];
	scanf("%s",&a);
	scanf("%s",&b);
	fun(a,b);
	return 0;
}

ps:最基础的函数定义,要注意字符串输入的要求

自定义函数中return 0;仍不可省

 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

自定义函数 用void不就好了,反正不需要返回值。   用char fun(char a[],char b[]),而不用void(。。。)是有什么特殊的原因么?
2017-07-19 16:12:52
  • «
  • 1
  • »