3
I’ve been doing a list exercise on strings and researched examples. One of the codes was this:
/* strlen example */
#include <stdio.h>
#include <string.h>
int main ()
{
char szInput[256];
printf ("Entre com uma frase: ");
gets (szInput);
printf ("A frase com que vc entrou tem %u de caracteres",(unsigned)strlen(szInput));
return 0;
}
I’d like to understand what makes the %u
and the following command line, (unsigned)strlen(szInput)
.
By the way, that code is of that website.
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site.
– Maniero