我的代码似乎崩溃每次我运行它,我想要的是找到一个句子一个大写字母一个程序(STR [MAX]),并打印出有多少次发现它计划在C崩溃
我从生成日志警告(警告:“C”这个功能可以用来初始化)(非常入门级的程序员在这里!)
#include <stdio.h>
#include <string.h>
#include "genlib.h"
#include "simpio.h"
#include "ctype.h"
#define max 26
void checktimes(char str[],char temp);
int main()
{
char str[max], temp;
printf("Type a sentence with 25 characters max :");
gets(str);
int i;
for(i=0;i<=max;i++)
{
temp = str[i];
if(isupper(temp))
checktimes(str,temp);
}
return 0;
}
void checktimes(char str[],char temp)
{
int j,i;
char c;
for(j=0; j<=max ; j++)
{
str[i] = c;
if(c == temp)
i++;
}
printf("%c --> %d",temp,i);
}
'为(I = 0; I <= MAX;我++)' - 'i'将从'0'去'max' *包括的*。看到一个问题?那么,和标准没有关于'得到'.. –
而你的问题是....? – DevNull
错误消息对您的问题非常具体。另外,学会使用调试器(给男人一条鱼,.......) – KevinDTimm