c語言用printf列印陣列,包含需要輸出的資料,可以是常量(字元常量、數字常量、字串常量),變數,以及運算式。
此處的資料應當與前面的format中的格式控制符一一對應(如果不對應會產生錯誤)。 例如:
int a=1;
float b=1。0;
char str[12]=“Hello World”;
printf(“This is an example of printf:\n”);
printf(“a is %d,b is %f,and a+b=%f”,a,b,a+b);
printf(“I want to say,%s”,str);