Hi all,
I defined a struct in the header like this:
Then I tried to initialize in .c file:
And for the second line from .c file, Igot errors:
error C2040: 'dfi_hashtable_ ptr' : 'int ' differs in levels of indirection from 'struct _s_ip_dfi_hasht able_entry *'
error C2099: initializer is not a constant.
What's wrong with my code?
I defined a struct in the header like this:
Code:
#define DFI_HASH_TABLE_SIZE_LOG 16
#define DFI_HASH_TABLE_SIZE (1<<DFI_HASH_TABLE_SIZE_LOG)
...
typedef struct _s_ip_dfi_hashtable_entry
{
struct _s_ip_dfi_tuples tuples;
int action;
int rate;
int threshold_action;
int penalty_rate;
int packets;
}ip_dfi_hashtable_entry;
Code:
ip_dfi_hashtable_entry * dfi_hashtable_ptr; dfi_hashtable_ptr = (struct _s_ip_dfi_hashtable_entry *) mem_alloc (sizeof(struct _s_ip_dfi_hashtable_entry)*DFI_HASH_TABLE_SIZE);
error C2040: 'dfi_hashtable_ ptr' : 'int ' differs in levels of indirection from 'struct _s_ip_dfi_hasht able_entry *'
error C2099: initializer is not a constant.
What's wrong with my code?
Comment