I want to print size_t
type data in C but wasn't able to print it. I am trying to print it by using %d
specifier but I got following error:
warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t’
I want to print size_t
type data in C but wasn't able to print it. I am trying to print it by using %d
specifier but I got following error:
warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t’
In order to print the size_t
variable, use the %zu
modifier instead of %d
.
z
tells that the argument size is equal to size_t
size.u
stands for unsigned.If you are working with the Microsoft compiler, use the %Iu
modifier instead.