C语言中printf()的参数是什么,数据类型,数据结构是什么

如题所述

1printf的参数是可变的,可以在<stdio.h>头文件中查找的,第一个参数是格式字符串,然后跟进的是各个需要输出的变量,如printf("%d %d %c\n",a,b,c);
"%d %d %c\n"这个字符串是第一个参数,a是第二个,b是第三个,c是第四个;printf的参数个数是可变的,要根据你需要输出的变量而定;
2数据类型:
包括:char,int,float,double以及unsigned int /char;long int ,long float,long long int;short int,还包括struct,union,enum等等;
3数据结构简单的说就是数据的组织形式,包括逻辑结构和物理结构(存储结构);主要由数据元素,数据关系和数据操作组成
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-06-19
以下来自MSDN
int printf( const char *format [, argument]... );

format

Format control格式控制

argument

Optional arguments可选的参数

//下面是用printf函数,实现标准输出的例子
/* PRINTF.C: This program uses the printf and wprintf functions
* to produce formatted output.
*/

#include <stdio.h>

void main( void )
{
char ch = 'h', *string = "computer";
int count = -9234;
double fp = 251.7366;
wchar_t wch = L'w', *wstring = L"Unicode";

/* Display integers. */
printf( "Integer formats:\n"
"\tDecimal: %d Justified: %.6d Unsigned: %u\n",
count, count, count, count );

printf( "Decimal %d as:\n\tHex: %Xh C hex: 0x%x Octal: %o\n",
count, count, count, count );

/* Display in different radixes. */
printf( "Digits 10 equal:\n\tHex: %i Octal: %i Decimal: %i\n",
0x10, 010, 10 );

/* Display characters. */

printf("Characters in field (1):\n%10c%5hc%5C%5lc\n", ch, ch, wch, wch);
wprintf(L"Characters in field (2):\n%10C%5hc%5c%5lc\n", ch, ch, wch, wch);

/* Display strings. */

printf("Strings in field (1):\n%25s\n%25.4hs\n\t%S%25.3ls\n",
string, string, wstring, wstring);
wprintf(L"Strings in field (2):\n%25S\n%25.4hs\n\t%s%25.3ls\n",
string, string, wstring, wstring);

/* Display real numbers. */
printf( "Real numbers:\n\t%f %.2f %e %E\n", fp, fp, fp, fp );

/* Display pointer. */
printf( "\nAddress as:\t%p\n", &count);

/* Count characters printed. */
printf( "\nDisplay to here:\n" );
printf( "1234567890123456%n78901234567890\n", &count );
printf( "\tNumber displayed: %d\n\n", count );
}