View Code of Problem 68

#include<stdio.h>
int max(int a,int b)
{
	return a>b?a:b;
}
int main()
{
	int a[3]={0};
	int i,max;
	for(i=0;i<3;i++)
		scanf("%d",&a[i]);
	max=max(max(a[0],a[1]),a[2]) 
	printf("%d",max);
	
	
	return 0;
}
/*
Main.c: In function 'main':
Main.c:12:10: error: called object 'max' is not a function or function pointer
  max=max(max(a[0],a[1]),a[2]) 
          ^
Main.c:9:8: note: declared here
  int i,max;
        ^
Main.c:12:6: error: called object 'max' is not a function or function pointer
  max=max(max(a[0],a[1]),a[2]) 
      ^
Main.c:9:8: note: declared here
  int i,max;
        ^
Main.c:13:2: error: expected ';' before 'printf'
  printf("%d",max);
  ^
*/

Double click to view unformatted code.


Back to problem 68