How to access **pointer from structure
Question posted by: eeshani
(Newbie)
on
August 21st, 2008 05:45 PM
Hi,
I want to access ** pointer from pointer to structure. Pls guide me in the code given below:
sturct m
{
int i;
struct n ** pCurrLine; // Ram pointer
struct m *prev;
struct m *nxt;
};
struct n
{
int x[10];
struct n *pre;
struct n *nxt;
};
*pcurrline = &pLine_cur_ptr;
struct n *pLine_cur_ptr;
pLine_cur_ptr = &cur_Line;
struct m *mCurr;
Now if I have to access pCurrLine then how should I proceed.
I tried :
mCurr->pCurrLine = mCurr->pCurrLine->pre ; // error
mCurr = mCurr->pre; /// Is right
pls help
Thanks,
2
Answers Posted
Quote:
Originally Posted by eeshani
*pcurrline = &pLine_cur_ptr;
if pcurrline is not initialized ( points nowhere ) you will write
this pointer somewhere in ram. It is not good.
Quote:
Originally Posted by
I tried :
mCurr->pCurrLine = mCurr->pCurrLine->pre ; // error
mCurr->pCurrLine is a pointer to pointer, so you need something like
(*(mCurr->pCurrLine))->pre
Quote:
Originally Posted by newb16
if pcurrline is not initialized ( points nowhere ) you will write
this pointer somewhere in ram. It is not good.
mCurr->pCurrLine is a pointer to pointer, so you need something like
(*(mCurr->pCurrLine))->pre
Thank you...I worked according to your suggestion. I am also type casting the ROm pointer into RAM so its working at this stage...lets see
Once again Thanks...I appreciate your help.
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 197,047 network members.
|