Hi Guys, Firstly let me compliment on an excellent site to help beginner developers like me. I have a hangman project due today but still feel very loss with my code and would appreciate if you could guide me in the right direction.
I'm basically trying to load a file with words into an array while doing that i want to display the array to screen to see that is correctly reading the file. I have written my algorithm and will be going through it step by step but i'm stuck on the beginning stages with an error "line 15.12: 1506-195 (S) Integral constant expression with value greater zero is required" Please your assistance in this regardswill be appreciated.
This is my code snippet.
Code:/* Author: Me ** This is my Hangman program, what a mission it was to make this work. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define CHANCES 10 #define MAXIMUM 8 #define maxAttempts 10 int main ( void ) { char MAX = 8; char words[MAX]; int value, j, k; int count = 0; FILE *fp; /* Read the file of words into the array*/ fp = fopen ("words.txt", "w+"); for (k =0; k < MAX; k++) { fprintf(fp,"%c\n", words[k]); // then display to see if it works. } fclose(fp); }



LinkBack URL
About LinkBacks



