sorry for the long title, but it pretty much sums it all up. I have a 2 test structures, and in one I have a 2d char array, which is essentially a 1d string list.
However I can't seem to interact with it on the same level as I can a normal 2d char array. Using
char test[][]={"stuff", "stuff2"}; approach won't work, the curly brackets makes it unhappy, removing the curly brackets helps, however from debug tests it seems that nothing gets written.
Can anybody help me assign some data to a 2d char array within this structure?
#include <stdio.h>
typedef struct a{
int a;
}A;
typedef struct b{
char ba[25][12];
int bb[12];
}B;
B test;
int main (){
test.ba[25][12]="a","b";
printf ("%s\n%s", test.ba[0][0], test.ba[0][1]);
//returns null here
return 0;
}
I get an access violation error if I try to use strcpy so i'm either going outside the array bounds or am trying to write to read only memory.
Huge thanks in advance.