#include<stdio.h> 
#include<stdlib.h> 
void main() 
{ 
        printf("请输入一个小于100字符的字符串\n"); 
        char str[1024]; 
        scanf("%s", str); 
 
        int i; 
        int a = 0; 
        for (i = 0; str[i] != '\0'; i++) 
        { 
                if (str[i] == 'A') 
                { 
                        a++; 
                } 
         
        } 
 
        printf("%s", a); 
 
        system("pause"); 
 
} 
写了这个代码,是求输入字符串中A的个数。但是运行起来输入AA后,弹出对话框“0x0F1DFB53 (msvcr120d.dll) (基础测试题.exe 中)处有未经处理的异常:  0xC0000005:  读取位置 0x00000002 时发生访问冲突。”。求解~谢谢 |   
        
 
    
    
    
     
 
 |