-
Structure with string
I am trying to create a constant structure containing string, which does not seems possible.
Hopefully someone can help me out by giving me some pointer.
Here is my code
Code:
Constant struct CData{
char D1[] = "Data1";
char D2[] = "Data2";
char D3[] = "Data3";
};
Many Thanks!
-
A structure is a blue print, think of it as a 'type', types can't hold data (ie, int != some random number, it's a type).
Code:
struct CData
{
char d1[16], d2[16], d3[16];
};
struct CData thingy = {"Data1", "Data2", "Data3"};
Would work.
-
In this case there will never be a constant structure?
as in we call only do it as
const struct Data Somedata;
-
-