S
SAUHING LEE
I am a beginner in C. I want to dynamically allocate the size of two
arrays inside a struct at compile time.(the size of the array is not
known before user input it).
The following code won't compile because of not specifying the array
size.
Any know how to do it using malloc?
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int list[];
int array[];
} array_holder;
int main()
{
int array_size;
scanf(" %d", &array_size);
}
arrays inside a struct at compile time.(the size of the array is not
known before user input it).
The following code won't compile because of not specifying the array
size.
Any know how to do it using malloc?
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int list[];
int array[];
} array_holder;
int main()
{
int array_size;
scanf(" %d", &array_size);
}