关于一个错误的指针
#include <iostream>
using namespace std;
//建立结构
typedef struct BSTree
{
int x; //值
struct BSTree *next;
};
BSTree *SearchBST(BSTree *T , BSTree *f)
{
if(T == NULL) return f;
else SearchBST(T->next , T);
}//SearchBST
int main()
{
BSTree *p = NULL , *TH;
TH = (BSTree *)malloc(sizeof(BSTree));
TH->x = 5;
TH->next = NULL;
p = SearchBST(TH , TH);
cout << p;
return 0;
}
cout << p;我感觉输出应该是TH的地址阿
但不知为什么是0
要怎么改正