//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 );
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
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."Originally Posted by Thantos
and ,i'm sorry, , What is the meaning of cast?
thx.
Last edited by L.O.K.; 11-27-2004 at 05:44 PM.
Preceding an expression by a parenthesized type name converts the value of the expression to the named type.Originally Posted by L.O.K.
FAQ > Explanations of... > Casting malloc
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Originally Posted by Dave_Sinkula
Oh, thx so much.