题目内容

设已有定义:float x;则以下对指针变量P进行定义且赋初值的语句中正确的是( )

A. float *p=1034;
B. int *p=(float)x;
C. float p=&x;
D. float *p=&x;

查看答案
更多问题

下面程序的功能是从键盘输入10个整数,用函数编程实现计算其最大值和最小值,并互换它们所在数组中的位置。程序运行结果如下:Input n(n<=10):10↙Input 10 Numbers:1 4 3 0 –2 6 7 2 9 -1 ↙Exchange results:14309672-2-1按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。#include void ReadData(int a[], int n);void PrintData(int a[], int n);void MaxMinExchang(int a[], int n);void Swap(int *x, int *y);int main(){ int a[10], n; printf("Input n(n<=10):"); scanf("%d", &n); printf("Input %d numbers:", n); ReadData(a, n); MaxMinExchang(a, n); printf("Exchange results:"); PrintData(a, n); return 0;}/* 函数功能:输入数组a的n个元素值 */void ReadData(int a[], int n) { int i; for (i=0; i maxValue){maxValue = _______;maxPos = ____;}if (a[i] < minValue){minValue = a[i];minPos = i;} } Swap(________________);}/* 函数功能:两整数值互换 */void Swap(int *x, int *y) { int ________; temp = *x; _________; *y = temp; }

A. 第41行:int a[]第49行:a[n-1]第50行:n-1第58行:*a[maxPos], *a[minPos]第64行:&temp第66行:x = y
B. 第41行:int a[]第49行:a[0]第50行:0第58行:&a[maxPos], &a[minPos]第64行:*temp第66行:x = y
C. 第41行:int a第49行:a[i]第50行:i第58行:a[maxPos], a[minPos]第64行:temp第66行:*x = *y
D. 第41行:int a[]第49行:a[i]第50行:i第58行:&a[maxPos], &a[minPos]第64行:temp第66行:*x = *y

下面程序中子函数MonthDay()的功能是将某年的第几天转换为某月某日。程序的运行结果如下:Please enter year, yearDay:2014,100↙month = 4, day = 10按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。#include void MonthDay(int year, int yearDay, int *pMonth, int *pDay);int dayTab[2][13] = {{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}};int main() { int year, month, day, yearDay; printf("Please enter year, yearDay:"); scanf("%d,%d", &year, &yearDay); _________________; printf("month = %d, day = %d\n", month, day); return 0; }/* 函数功能:对给定的某一年的第几天,计算它是这一年的第几月第几日 */void MonthDay(int year, int yearDay, int *pMonth, int *pDay){ int i, leap; leap = _________________________; for (i=1; yearDay>dayTab[leap][i]; i++) {yearDay = ______________________; } ______________; /* 将计算出的月份值赋值给pMonth所指向的变量 */ *pDay = yearDay; /* 将计算出的日号赋值给pDay所指向的变量 */}

A. 第10行: MonthDay(year, yearDay, month, day)第19行:((year % 4 == 0) || (year % 100 != 0)) || (year % 400 == 0)第23行:yearDay - dayTab[leap][i]第25行:pMonth = i
B. 第10行: MonthDay(year, yearDay, &month, &day)第19行:((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)第23行:yearDay - dayTab[leap][i]第25行:*pMonth = i
C. 第10行: MonthDay(&year, &yearDay, &month, &day)第19行:((year % 4 == 0) || (year % 100 != 0)) && (year % 400 != 0)第23行:yearDay + dayTab[i][leap]第25行:*pMonth = i
D. 第10行: MonthDay(&year, &yearDay, month, day)第19行:((year % 4 == 0) && (year % 100 == 0)) || (year % 400 == 0)第23行:yearDay - dayTab[i][leap]第25行:pMonth = i

下面程序的功能是用函数编程实现两个数组中对应元素值的交换。按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。程序的运行结果示例:Input array size(n<=10):5↙Input array a:1 2 3 4 5↙Input array b:6 7 8 9 10↙Output array a:678910Output array b:12345#include #define N 10void ReadData(int a[], int n);void PrintData(int a[], int n);void Swap(int *x, int *y);int main(){ int a[N], b[N], i, n; printf("Input array size(n<=10):"); scanf("%d", &n); printf("Input array a:"); ReadData(a, n); printf("Input array b:"); ReadData(b, n); for (i=0; i

A. 第17行:a[i], b[i]第52行:temp = *x第53行:*x = *y第54行:*y = temp
B. 第17行:&a[i], &b[i]第52行:*temp = *x第53行:*x = *y第54行:*y = *temp
C. 第17行:&a[i], &b[i]第52行:temp = *x第53行:*x = *y第54行:*y = temp
D. 第17行:a[i], b[i]第52行:temp = x第53行:x = y第54行:y = temp

声明语句int *f();中f的含义是________。

A. 一个返回值为指针类型的函数名
B. 一个用于指向函数的指针变量
C. 一个用于指向一维数组的行指针
D. 一个用于指向整型数据的指针变量

答案查题题库