Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- int a[] = {'a','b','c','d','e' /*etc...*/},
- len = 0,
- size = sizeof(a)/sizeof(int);
- char str[] = "abscinence";
- char * p;
- len = sizeof(str);
- for(int i = 0; i < len; i++){
- for(int c = 0; c < size; c++){
- p = (char*) &a[c];
- if( *p != str[i] ) continue;
- p++;
- *p = *p + 1;
- }
- }
- for(int i = 0; i < size; i++){
- p = (char*) &a[i];
- p++;
- printf("\'%c\' has %d matches\n",a[i],*p);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement