Is the use of the function "find_max" in the code below an example of using a function in the conventional way?

Viewed 56

Is the function 'find_max' (at the end of the second 'printf' statement) being called in a recursive manner? Whilst it's at the end of the line of code, the function executes before printing anything.

#include <stdio.h>

char name[100];
int find_max();

int main(void)

{
   printf("Whats your name? ");
   scanf("%s", name);
   printf("Your name is %s, and the max number is %d.\n", name, find_max());
}


int find_max()
{
  int a = 0;
  int b = 0;
   printf("What is the first number?\n");
   scanf("%d", &a);
   printf("What is the second number?\n");
   scanf("%d", &b);

   if (a > b) return a;
   else return b;
   return 0;
}
0 Answers
Related