今天偶然发现能这样用,求解释。
这种用法很明显会造成内存泄漏,有没有更好的方法?

引用:
#include <windows.h>

int _tmain(int argc_TCHARargv[])
{
    
const struct  
    
{
      
char *const pszID;
      
int *pIndex;
    }
table[] = {
      {
"a"new int},
      {
"b"new int},
      {
"c"new int},
      {
"d"new int}
    }, *
p;

  
long table_count sizeof(table)/sizeof(table[0]);
  
table;
  
for (long index 0index table_count; ++index, ++p)
  {
    
if (== lstrcmpiA("b"p->pszID))
    {
      *
p->pIndex index;
      
printf("%d\n", *p->pIndex);
    }
  }

  
system("pause");
    
return 0;
}