summaryrefslogtreecommitdiff
path: root/sem_2/HLIN202/TP/TP5-6/ex5/exo5.cpp
blob: ae369d452ca62101704edc2f499ff07ef6cd3d43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>

int* max ( int* a, int* b, int* c) {
  if ( *a>=*b && *a>=*c) return a;
  if ( *b>=*a && *b>=*c) return b;
  if ( *c>=*a && *c>=*b) return c;
  else return 0;
}

int main () {
  int x=2, y=4, z=3;
  std::cout<<"le max est à l'adresse : " << max(&x,&y,&z) << std::endl;
  return 0;
}