-
#include
main()
int i,a[9],temp,*pmax=0;
for(i=0;i<9;i++) *Array subscripts cannot be crossed * scanf("%d",&a[i]);
if(a[i]>*pmax)*pmax=a[i];
printf("%d",*pmax);*After the comparison is completed, it can be output, if it is placed at the end, the output may not be the maximum*
if(*pmax!=a[0]) *Compare value, not compare address * temp=*pmax;
pmax=a[0];
a[0]=temp;
-
void main()
int i,a[9],temp,*pmax=&a[0];
for(i=0;i<9;i++)
scanf("%d",&a[i]);
if(a[i]>*pmax)*pmax=a[i];
if(pmax!=&a[0])
temp=*pmax;
pmax=a[0];
a[0]=temp;
printf("%d",*pmax);
The initialization pointer can no longer be defined, and the pointer space cannot be directly assigned, so the space must be requested.
-
Visually at a loss ......It is recommended that you do not assign a value to the pointer.
for(i=0,*pmax=i;i<10;i++) This one is better, right?
Instead, separate the loop from the input ... ...... with two loops
-
Your A length is 9, but your loop is 10
-
Method 1: (Using the Comparative Method).
Method 2: (using the foaming method).
Method 3: (Modular design with functions).
-
Analysis: Since we talk about swaps, these 15 numbers vary.
The algorithm steps are as follows:
1.Put the integer into the one-dimensional array a;
2.Copy the integer into another array b and sort it by the sorting algorithm to get the second largest number and the second decimal number.
3.The obtained sub-largest and sub-decimal numbers are assigned to x and y, respectively.
4.In array a, x is found and replaced with y, and y is found and replaced by x;
5.Output array a, end.
Corrections are welcome!
Il DIVO profile ** from CCTV).
This "men's classical quartet" is called "il divo", which means "opera hero" and "extraordinary performer". Does the melody of their title song sound familiar? The title song called "Don't Break My Heart" is based on the 1995 song of the same name by black female singer Tony Blackton. >>>More
1. Self-improvement and self-reliance are the prerequisites for success;
1. I swear (584), I will go out with you (5682177778), love with you (12234), go together (1798), go for a walk (76868), I don't want to be with you (587129955), being loved is happiness (829475). >>>More
Gratitude is a rainbow that flies in the sky, so that people with gloomy eyes can see the beauty of the world. >>>More
The first item: half-squat jump.
1. At the beginning, half-squat to? 2. Jump up at least 20 to 25cm from the ground. (If you find it easy, you can jump to 25 to 30cm). When in the air, keep your hands behind your back. When you land, finish it once. >>>More