static int (*g_data)[3];
I’d like to new N elements of int[3]. I’m only able to this as follows:
g_data = (int(*)[3]) new int[N*3];
I know that this is okay and using struct would be an alternative solution. But, just for curiosity, can I directly call new for int[3], i.e., without the type conversion?
Since
g_datais a pointer to a 1D array of 3int, to make an array of N such arrays of 3, you simply useint [N][3]: