That code I posted was just a quick example, in my actual program I checked for a NULL file and used free() for the dynamic memory alloc. But I wasn't aware casting malloc was bad practice, thanks.
Type: Posts; User: atac
That code I posted was just a quick example, in my actual program I checked for a NULL file and used free() for the dynamic memory alloc. But I wasn't aware casting malloc was bad practice, thanks.
Nevermind, I just figured it out! I wasn't terminating the strings in the array itself.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]){
I'm making a Jeopardy game and when I read text from a file into arrays to set the categories, questions and answers a couple of the strings are not terminating and they are printing that junk box...