I'm trying to get this program to work but it keeps printing the same thing (the before array and the after array with nothing in it) even when I'm talking the before array out of the program completely and recompiling it. I've restarted my compiler and copied and pasted the program into a new source file but it's still not working. Idk if it's the program (which may have errors I'm still a beginner) or my compiler (Dev C++). Please let me know if you're able to run it and what happens. Thanks!
Code:#include <stdio.h> int main (void) { // Local Declarations char temp; char a[6] = {'z', 'x', 'm', 's', 'e', 'h'}; char* walker; char* plast; // Statements plast = a + 5; temp = *a; printf("Array before: %c %c %c %c %c %c\n", 'z', 'x', 'm', 's', 'e', 'h'); printf("Array after: "); for (walker = a; walker < plast; walker++) {*walker = *(walker + 1); *walker = temp; printf (" %c", temp); } // for getch(); return 0; }//main



LinkBack URL
About LinkBacks


