Created
May 11, 2018 17:11
-
-
Save edenizk/65f2b12dd5c67068203a257dafb72241 to your computer and use it in GitHub Desktop.
Arrays in C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
float minm(float a1[],int size); | |
int main() | |
{ | |
float a1[]={2.5,5.7,1.2,2.1,4.3}; | |
float *p; | |
p=a1; | |
while(p<a1+sizeof(a1)/sizeof(float)) | |
{ | |
printf("%p -> %f \n",p,*p); | |
p++; | |
} | |
float min=a1[1]; | |
int i=0; | |
min = minm(a1,sizeof(a1)/sizeof(float)); | |
printf("the min value in array : %f\n",min); | |
} | |
float minm (float a1[], int size) | |
{ | |
float tmp=a1[0]; | |
int i; | |
while (i<size) | |
{ | |
if(a1[i]<tmp) | |
{ | |
tmp = a1[i]; | |
} | |
i++; | |
} | |
return tmp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment