//in this way:
// like this??Code:void ChangeAddr( int **b ){
*b = (int*) malloc( ... );
}
void main(){
int *a ;
ChangeAddr( a );
}
// THANK Q>
//in this way:
// like this??Code:void ChangeAddr( int **b ){
*b = (int*) malloc( ... );
}
void main(){
int *a ;
ChangeAddr( a );
}
// THANK Q>
Well you shouldn't cast the return of malloc. Also you shouldn't use void main()
But yes that would do it.
Not quite.
Code:ChangeAddr( a ); -> ChangeAddr( &a );
Heh I was looking at the ChangeAddr function I didn't even notice the call.
OK, well, now I've understood, FAQ:"The return type of main() must always be an int, this allows a return code to be passed to the invoker."Quote:
Originally Posted by Thantos
and ,i'm sorry, , What is the meaning of cast?
thx.
Preceding an expression by a parenthesized type name converts the value of the expression to the named type.Quote:
Originally Posted by L.O.K.
FAQ > Explanations of... > Casting malloc
Quote:
Originally Posted by Dave_Sinkula
Oh, thx so much.