c++ - 一个简单的C语言程序,无法读入字符变量?

浏览:22日期:2023-06-01

问题描述

代码如下,程序一直报错,报错图在这里

#include <stdio.h>#include <stdlib.h>#include <string.h>#define N 30int Quan(char ht[N],char a){ int n=0,m=0; for(n=0;n<N;n++){if(ht[n]==a){ m++;} } return m;}int main(){ int m=0; char ht[N]; scanf('%s',ht); m=Quan(ht[N],’A’); printf('%d',&m); return 0;}

c++ - 一个简单的C语言程序,无法读入字符变量?

如图可知数据并没有读入,不知那里写错,请求大神指点

问题解答

回答1:

printf('%d',&m);改为printf('%d',m);

相关文章: