size_t in c++?

S

saneman

In a file I have made:

size_t bb;
bb = 3u;
printf("bb %d\n");

which prints:

bb 2280640

But what is 'u' and why does it print the above number?
 
I

Ismo Salonen

saneman said:
In a file I have made:

size_t bb;
bb = 3u;
printf("bb %d\n");

which prints:

bb 2280640

But what is 'u' and why does it print the above number?
Prints garbage from stack, there is no argument given for %d.
Should be : printf("bb %d\n",bb);

ismo
 
M

Markus Moll

Hi

Ismo said:
Prints garbage from stack, there is no argument given for %d.
Should be : printf("bb %d\n",bb);

Even then, %d and size_t don't match. Use %zu for size_t, as it might be
larger than an int.

Markus
 
A

Anarki

Hi




Even then, %d and size_t don't match. Use %zu for size_t, as it might be
larger than an int.

Markus

excuse me Markus whats %zu? whats the z stand for?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top