You could make it C++ like:
Code:
class my_struct{
public:
TCHAR *FileName;
int Index;
int Frequency;
mystruct(){
Filename = NULL;
Index = 0;
Frequency = 0;
};
};
my_struct *test = new my_struct;
if (test->FileName != NULL) {
print("Odd pointer found");
return -1;
} Or make it the way real C programmers do
Code:
typedef struct {
TCHAR *FileName;
int Index;
int Frequency;
} my_struct;
my_struct *test = (my_struct*)malloc (sizeof(my_struct));
if(!test)
{
perror("Not enough space on the heap\n");
return -1;
}
memset(test, 0, sizeof(my_struct));
if (test->FileName != NULL) {
print("Odd pointer found");
return -1;
}