运行的结果是错误的
#include <stdio.h>
int main(void)
{
//set a array
double array[] = { 1,-0.3,6,40,17 };
double largest = array[0], smallest = array[0];
//find the largest and smallest value in array
for (int i = 0; i < 5; i++)
{
if (array[i] > largest) {
largest = array[i];
}
if (array[i] < smallest) {
smallest = array[i];
}
}
printf("the largest number is %f\n", &largest);
printf("the smallest number is %f\n", &smallest);
double sum;
//a formular of addition
sum = largest + smallest;
printf("the sum of the largest and smallest is %f\n", &sum);
return 0;
}
在每一行的printf都显示c6272
运行后所有的数都是0