struct problem and general C question
First question, whats wrong with this stucture:
Code:
#include "edit.h"
struct file_info {
int buffer[BUFSIZE];
int position;
char charAt;
} *file;
int displayFile(FILE *fp)
{
file = malloc(sizeof * file);
return 0;
}
It says there needs to be a semicolon somewhere, but I have that.
My second question: In c, is there a place within a function before or after something that you cannot declare variables? I tried declaring an int right after a malloc statement above it, and it was giving me undefined indentifier problems. Are there any general rules about declaration that I should know/are different than in c++? Thanks a lot.