Commit 16921572 by chazog

Upload New File

parent ccbd4eac
Showing with 33 additions and 0 deletions
#include <stdio.h>
void funk(int *ptr, int size, int *min, int *max);
int main()
{
int array[10];
int *ptr = array;
int i;
for (i = 0; i < 10; i++)
{
*(ptr + i) = i;
printf("%d\n", *(ptr + i));
}
int min = ptr[0], max = ptr[0];
funk(ptr, 10, &min, &max);
printf("min:%d\tmax:%d", min, max);
return 0;
}
void funk(int *ptr, int size, int *min, int *max)
{
int i;
for (i = 0; i < size; i++)
{
if (*min > ptr[i])
{
*min = ptr[i];
}
if (*max < ptr[i])
{
*max = ptr[i];
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment