Hello,
This question is about a uni assignment, but I am NOT asking help on how to do it.
I've come across an error and I cannot, for the life of me, figure out what's wrong.
My project contains a few files, but my error is occuring in "file.c" so I will show you "file.h" and "file.c". I hope that's all you need!
file.h:
Code:
#ifndef _FILE_H_
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
typedef char * string;
void increaseBuffer(string *buffer, size_t *length);
#endif
file.c
Code:
void increaseBuffer(string *buffer, size_t *length) {
string tempB = *buffer;
size_t tempL = *length;
string tempS;
size_t newLength = 2*tempL+1;
tempS = realloc(tempB, newLength);
if(tempS == NULL) {
fprintf(stderr, "Could not increase buffer size\n");
exit(EXIT_FAILURE);
}
tempB = tempS;
tempL = newLength - 1;
*buffer = tempB;
*length = tempL;
}
The error I'm getting is
file.c:1: error: expected ')' before '*' token
Any ideas?
Thank you for your time!
G.
P.S. My compiler is GCC 4.1.2 running on linux inpus lite (Fedora)