If you are in C++, just do :
struct Coder { float **data; }; typedef Coder *AUTO;
Also you have to be sure that the AUTO declaration is done after the declaration of your struct or you can forward-declare your struct.
Also, it is possible that NULL is undefined.
You can replace it by 0 or just look at the link I just gave you.
Here is a live example.
EDIT : The code you gave us cannot work :
#include <tchar.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <conio.h> #include <iostream> struct Coder { float **data; // 2-D matrix }; typedef Coder *AUTO; AUTO myFeatures = new Coder; myFeatures->data = NULL; // Forbidden int main (){ myFeatures->data = new float *[2]; myFeatures->data[0] = new float [2]; }
You can only have declaration in namespace scope, not expression like that.
In §7.3.1/1 of the standard :
namespace-body:
declaration-seqopt
which says the namespace-body can optionally contain only declaration.
This code will work :
// Your includes struct Coder { Coder() : data(NULL) {} // Constructor who initialize data to NULL // via the member-initialization-list float **data; // 2-D matrix }; typedef Coder *AUTO; AUTO myFeatures = new Coder; // Do you want to keep it in global ?? // It's not a really good design int main (){ // You should put your declaration here. // myFeatures->data = NULL; useless now myFeatures->data = new float *[2]; myFeatures->data[0] = new float [2]; }
typedefdoesn't have a name. Also, what's convenient about theAUTOtypedef? It just looks ugly and obfuscating to me.typedefon thestruct, to begin with? And whiletypedefing the pointer is already ugly and obfuscating, giving it a completely unrelated name, and all caps at that?