char name[] = "TonyDeng"; char strFormat[80]; int len = 5; sprintf(strFormat, "\%%%dd", len); printf(strFormat, strlen(name));