What does “%.*s” mean in printf?

You can use an asterisk (*) to pass the width specifier/precision to printf(), rather than hard coding it into the format string, i.e.

void f(const char *str, int str_len)
{
  printf("%.*s\n", str_len, str);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)