Hi, I use Code::Blocks and I'm writing a program that is supposed to count the number of possible variations between 10 letters of the alphabet. The program compiles, but once I run it, it crashes and gives me this error:
And I have no clue why is that happening. Here is the code:Process terminated with status -1073741819
Any help will be welcome.Code:#include <stdio.h> #include <stdlib.h> #include <string.h> void move(char *one, char *two); main() { char alf[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'}; int count, index, max = 0; for (index = 9; strcmp(alf[9], 'a') != 0; count++) { if (index == 0) { index = 9; continue; } move(&alf[index], &alf[index - 1]); max++; } printf("%d", max); return 0; } void move(char *one, char *two) { int aux; aux = *two; *two = *one; *one = aux; }
Thanks in advance.



LinkBack URL
About LinkBacks


