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

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

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#define N 30

int 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;

}

图片描述

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

回答:

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

以上是 一个简单的C语言程序,无法读入字符变量? 的全部内容, 来源链接: utcz.com/p/192458.html

回到顶部