naver_
http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040101&docId=288254510
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
# define SIZE 10
// function prototype ++++++++++++++
void numBerSetting(int* ptrArry);
void search(int* ptrArry, int num);
// +++++++++++++++++++++++++++++++++
int main(void) {
int arry[SIZE] = {0,}; // initiallize
int choice_number = 0;
numBerSetting(arry);
printf("Enter the number you want to search: ");
scanf("%d", &choice_number);
search(arry, choice_number);
return 0;
} // end of main function
void numBerSetting(int* ptrArry) {
srand((unsigned)(time(NULL)));
int i; // index
for (i = 0; i < SIZE; i++) {
*(ptrArry + i) = rand()%90 + 10;
// 10 , 11, ..., 99
}
// Test printf
//for (i = 0; i < SIZE; i++) {
// printf("%d\n", *(ptrArry + i));
//}
} // end of numBerSetting function
void search(int* ptrArry, int num) {
int i; // index
for (i = 0; i < 10; i++) {
if (*(ptrArry + i) == num) {
printf("exist \n");
return;
}
}
printf("not exist \n");
} // end of search function