yea i think everyones thinking a bit hard on this haha im sure it should be easy!!
the code i have now is virtually the same im stuck:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main() {
int LetterCounts[26] = {0};
int c = 0, j = 0;
while ((c = getchar()) != EOF) {
if (isalpha(c))
c = toupper(c);
LetterCounts[c-'A']++;
}
for(j = 'A'; j < 'Z'; j++)
printf("%c: %d\n", LetterCounts[j+'A'], LetterCounts[j]);
return EXIT_SUCCESS;
}
and the error i get is:
Code:
i: -1081457140
: 6121771
: 1
: -1081452740
: 0
: -1081452728
?: -1081452699
K: -1081452666
R: -1081452624
_: -1081452605
y: -1081452588
: -1081452575
� -1081452559
� -1081452548
: -1081452534
: -1081452520
: -1081452449
!: -1081452412
: -1081452394
: -1081452362
: -1081452340
: -1081452310
: -1081452299
: -1081452288
d: -1081452252
Segmentation fault (core dumped)