I have piece of code like this and I want to alloc memory for two dimmensional struct array.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
struct complex
{
int re;
int im;
};
int main ()
{
int r = 5; //rows
int c = 6; //cols
struct complex (*wsk)[c];
wsk = (struct complex(*)[c])malloc(sizeof(struct complex)*r*c);
/* ... */
}
I'm not sure about the malloc()
part, is it correct?