Re: memory leakage problem
- From: "David Schwartz" <davids@xxxxxxxxxxxxx>
- Date: 30 Oct 2006 16:37:58 -0800
chets wrote:
Hi all
Can anyone tell me what is the difference between:-
*p=q; and p=&q; in C
where declaration is like this
char **p;
char *q;
*p=q; means: Take what p points to and set it equal to the current
value of the variable q.
For this to work, 'p' must point to a valid 'char *'. Otherwise,
changing the contents of what 'p' points to can lead to a crash. (And
if you haven't assigned a value to 'q', what value you put in is
undefined.)
p=&q; mean: Set p equal to the address of the variable q.
This has no special requirements. Since you declared 'p', it exists and
storage has been allocated for it, and of course 'q' always has an
address.
DS
.
- Follow-Ups:
- Re: memory leakage problem
- From: Spoon
- Re: memory leakage problem
- References:
- memory leakage problem
- From: chets
- memory leakage problem
- Prev by Date: Re: A simple program for Xlib....can anyone tell me what's wrong ?
- Next by Date: Maximum limit of signal queue
- Previous by thread: memory leakage problem
- Next by thread: Re: memory leakage problem
- Index(es):
Relevant Pages
|
|