Pointer troubles
Hello.I'm not very sure with pointers defining....
A pointer,normally,is defined this way:
1 2 3 4 5
|
type var=...;
type *p;
p=&var
|
Right?
But i saw somewhere the defining: *p=&var... whatt???is this correct?
And,at the functions arguments,the same:
1 2 3 4 5 6 7 8
|
type function(type *p){
.....
}
int main(){
type var;
function(&var);
}
|
WHY?....it hasn't got any sense...*p=&var??
This code
1 2 3 4 5
|
type var=...;
type *p;
p=&var;
|
in fact is equivalent to
1 2 3
|
type var=...;
type *p = &var;
|
So this code
function(&var);
can be imagined as
type function(type *p = &var );
Topic archived. No new replies allowed.