Skip to content

Instantly share code, notes, and snippets.

@taishi41228
Created March 5, 2013 00:44
Show Gist options
  • Save taishi41228/5087068 to your computer and use it in GitHub Desktop.
Save taishi41228/5087068 to your computer and use it in GitHub Desktop.
適当なプログラム ref: http://qiita.com/items/8c60e39d48473e5570aa
int findInt (int a[], int n, int x){
int i;
for (i=0; i < n; i++) {
if (a[i] == x) {
return 1;
} else {
return 0;
}
}
return -1;
}
#include <stdio.h>
void printMaxInt (int a[], int n);
void printArray (int a[], int n);
int findInt (int a[], int n, int x);
void printArray (int a[], int n){
int i;
for (i=0 ; i<n; i++) {
printf("x[%d] = %d \n",i,a[i]);
}
}
void printMaxInt (int a[], int n) {
int max = 0, i;
for (i = 0; i < n; i++) {
if (max < a[i]) {
max = a[i];
}
}
printf("%d\n", max);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment