Novice C language learning journey(4)

in #art5 years ago

梦幻光晕蓝色背景矢量图.png
About input and output of char two-dimensional array.
This code shows a error that "%c" need "int" parameter in the print statement. But the parameter is "char*" type.How to modify to input and output char?
No long after.I give the three solutions.the solution as follows:
the first solution as follows:
#include"stdio.h"
int main(void){

char a[3][5];
scanf("%c%c%c",&a[0][0],&a[1][0],&a[2][0]);
printf("%c %c %c\n",a[0][0],a[1][0],a[2][0]);
return 0;

}
捕获334.PNG
the second solution as follows:
#include"stdio.h"
int main(void){

char a[3][5];
scanf("%c%c%c",a[0],a[1],a[2]);
printf("%c\t%c\t%c\n",*a[0],*a[1],*a[2]);
return 0;

}
捕获334.PNG
the third solution as follows:
#include"stdio.h"
int main(void){

char a[3][5];
scanf("%c%c%c",a[0],a[1],a[2]);
printf("%c\t%c\t%c\n",a[0][0],a[1][0],a[2][0]);
return 0;

}
捕获334.PNG

Sort:  

According to the Bible, Is the Bible final and complete? How does it support science? (Part 4 of 4)

(Sorry for sending this comment. We are not looking for our self profit, our intentions is to preach the words of God in any means possible.)



Comment what you understand of our Youtube Video to receive our full votes. We have 30,000 #SteemPower. It's our little way to Thank you, our beloved friend.
Check our Discord Chat
Join our Official Community: https://beta.steemit.com/trending/hive-182074

This is a question of char two-dimensional array.