>The red line should return a NULL if the condition failed
Right, so Matsp's point was, where does it return to, and when do you actually call Print()?
>The red line should return a NULL if the condition failed
Right, so Matsp's point was, where does it return to, and when do you actually call Print()?
well since its a pointer array the values are passed by address but the return should just go back to main() so it can call the PRINT Function and display all the content thier would someone please give me an idea
Code:#include <stdio.h> #include <string.h> #include <ctype.h> void getWords(char * wbuf); void output(); FILE *fp; int main (void) { fopen_s(&fp,"file.dat", "rb"); getWord(fp); output(); } // Begining of Get Word Function // This Function Reads The input of a Text File void getWords(char* wbuf) { int c, i = 0; while ((c = fgetc(fp)) != EOF) if (isalpha(c) || ispunct(c)) { wbuf[i++] = c; } else { wbuf[i] = '\0'; return; } wbuf[i] = '\0'; } void output(char wbuf[]) { }
fp is of type FILE *. You should be passing a char array of some sort:Code:> getWord(fp);
Code:char word[100]; . . getWord(word);The same is true for output(). You should pass the word returned from getWord():Code:> output();
By the way your compiler should warn you about some of these errors. If it's not, you may need to change the compiler's warning level.Code:output(word);