Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include <stdlib.h>
- #define NUM 5
- int* max(int* a, int *b);
- int main(){
- int i,*num_max;
- int *x;
- x = (int *) malloc(sizeof(int)*NUM);
- for(i = 0; i < 5; i++){
- scanf("%d",&*(x+i));
- }
- num_max = max(x, (x+NUM)) ;
- printf("=%d\n",*num_max );
- return 0;
- }
- int* max(int *a, int *b){
- int i,*NUMMAX ;
- *NUMMAX = *a;
- for(i=0;i<NUM;i++){
- if(*NUMMAX <*(a+i)){
- *NUMMAX=*(a+i);
- }
- }
- //printf("%d\n",*NUMMAX);
- return NUMMAX;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement