Here's what I'm trying to do:
#include <stdio.h>
#include <stdlib.h>
struct myStruct {
int myVar;
}
struct myStruct myBigList = null;
void defineMyList(struct myStruct *myArray)
{
myStruct *myArray = malloc(10 * sizeof(myStruct));
*myArray[0] = '42';
}
int main()
{
defineMyList(&myBigList);
}
I'm writing a simple C program to accomplish this. I'm using the GNU99 Xcode 5.0.1 compiler. I've read many examples, and the compiler seems to disagree about where to use the struct
tag. Using a struct
reference inside the sizeof()
command doesn't seem to recognize the struct
at all.