※スタイルシート未対応ブラウザではレイアウトを正確に再現できません。
  > | advanced by | contents  | that returns in <    
                   < [modosusu] > Color magazine monochrome light and shade   font predetermined, Gothic Ming-style type longhand   size Konaka large   standard  


  Exercise 15   

  1. ..clause 1..: Basic knowledge
  2. ..clause 2..: Program readout
  3. Memo
  4. ..clause 4..: Description type
  5. ..clause 5..: Basic knowledge(example solution)
  6. ..clause 6..: Program readout(example solution)
  7. Memo(example solution)
  8. ..clause 8..: Description type(example solution)


[1] Basic knowledge


[  1-1  ]
What is called the number in the memory put on the variable?

[  1-2  ]
What is called the method of the substitution of the above-mentioned number for the variable and the treatment?
Example solution

It returns to contents.


[2] Program readout


[  2-1  ]
In the following program, though the return value of the sum function is void type
Explain concisely why it is at that can return the numerical result.
 
#include <stdio.h> 

void sum(int,int,int*);  

int main(void)  
{
	int value;  
	sum(50,100,&value);  
	printf("%d\n",value);  
	return 0;  
}

void sum(int min,int max,int *ans)  
{
	*ans = (min + max) * (max - min + 1) / 2;  
	return;
}
Example solution

It returns to contents.


Memo


[  3-1  ]
From among two or more numerical values input within the range of 0-100
Make the program displayed for the maximum value and minimum value.
When -1 is input, the input is judged ending.
However, obtain the maximum value and minimum value in one function other than the main function.
Moreover, the number of array elements in which the input numerical value is memorized is assumed to be ten.
It is assumed it is reluctant even if the error occurs when input any more.
The hint: Data can be judged to end if there is -1 in the array.
The hint: Only have to repeat the comparison with the variable that memorizes the maximum value to look for minimum value.
Example solution

It returns to contents.


[4] Description type


[  4-1  ]
In the issue, explain concisely what the pointer is.
Example solution

It returns to contents.


[5] Basic knowledge(example solution)


[  1-1  ]
Address

[  1-2  ]
Pointer
Problem

It returns to contents.


[6] Program readout(example solution)


[  2-1  ]
The third argument of the sum function is declared as a variable of the pointer type.
Because contents of the variable are rewritten directly by passing this the address.
Problem

It returns to contents.


Memo(example solution)


[  3-1  ]
 
#include <stdio.h> 

void maxmin(int array[],int *max,int *min);  

int main(void)  
{
	int i = 0,array[10],max,min;  
	
	Turn..number.
		scanf("%d",&array[i]);  
		i++;  
	} while (array[i - 1] != -1);  
	
	maxmin(array,&max,&min);  
	
	Printf ("Maximum value %d: Minimum value %d\n" max and min);  
	
	return 0;  
}

void maxmin(int array[],int *max,int *min)  
{
	int i = 0;  
	
	*max = 0;  
	*min = 100;  
	
	while (array[i] != -1) { if (array[i] > *max) *max = array[i]; if (array[i] < *min) *min = array[i]; 
		i++;
	}
}
- This problem is a quite difficult problem for the beginner.
  Read the example solution well.
Problem

It returns to contents.


[8] Description type(example solution)


[  4-1  ]
Short cut variable of a certain variable
Problem

It returns to contents.


< - It is advanced -> | in | head that returns  to returning  next |.