#include <stdio.h>
int main() {
int num = 20;
int* pnum = #
printf("Size of pointer variable: %dbytes\n", sizeof(pnum)));
return 0;
}
When I changed the build platform to 64bit (x64) in Visual Studio 2017, and compiled the above code, the warning message below appears.
warning C4477: 'printf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type '::size_t'
note: consider using '%zd' in the format string
The program itself works well, but how do I get rid of the warning message?
c
printf("%d", size of(pnum)) as shown in
is requested to change to warning
;printf("%zd", sizeof(pnum);
I don't think there will be any problem if I change it. Or you can write:
int size = sizeof(pnum);
printf("size of pointer variable: %dbytes\n", size);
© 2024 OneMinuteCode. All rights reserved.