Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print int * & unsigned int* in NSLog?

How to print int* (int pointer) and unsigned int* in log using NSLog?

- (int) doSomethingWith:(unsigned int)Msg withWparam:(unsigned int*)wParam withParameter:(int *) lParam {     NSLog(@"MSg:%d wParam:%u lParam:%u",Msg,wParam,lParam); //not working     return 1; } 

Warning: Format specifies type 'unsigned int' but the argument has type 'unsigned int *'

like image 300
HDdeveloper Avatar asked Jan 18 '13 10:01

HDdeveloper


1 Answers

Use %d for int. And the parameters are pointers, so use * to access the values pointed to.

NSLog(@"MSg:%d wParam:%u lParam:%d",Msg,*wParam,*lParam); 
like image 132
Joris Kluivers Avatar answered Sep 20 '22 10:09

Joris Kluivers