Quantcast
Channel: BlogoSfera » frequent
Viewing all articles
Browse latest Browse all 11

Getting most frequent characters in array in c

$
0
0

i am trying to get most frequent characters from array. Here’s my code #include <stdio.h> int main(void){ int c[1000]; char input[] = "abcdab"; int i; for(i=0; input[i]; i++) { c[input[i]]++; } int j = 0; char str = 0; for(i=0; i<256; i++){ if(c[i] > j) { j = c[i]; str = i; } } printf("%c\n", […]

The post Getting most frequent characters in array in c appeared first on BlogoSfera.


Viewing all articles
Browse latest Browse all 11

Trending Articles