1. ## enumerated types

What difference does this two way of using enum make(both give same output)? I dont understand why do we use enum to declare day1.

Code:
```#include <stdio.h>

main()
{
enum day{zero, one, two, three};
enum day day1;
day1 = one;
printf("%d ",day1);

return 0;
}```

Code:
```#include <stdio.h>

main()
{
enum Day {zero, one, two, three};
int day1;
day1 = one;
printf("%d ",day1);

return 0;
}```

2. Enums are solely to make your code clearer to read, but don't make a difference from a user standpoint.

If you had an enum of (Monday, Tuesday, Wednesday, etc) and set day1=Monday, then when you or someone else read your code it would be obvious what you are doing to day1. But if you used integers and set int day1=1 then it becomes confusing and one would have to read the rest of your code to understand what 1 meant, maybe its Sunday, maybe its the number of days since something happened, etc. But in the end, when you print day1, yes either way it will print as an int.

3. ## find max number in array

i cant understand the following recursive function. Can someone explain how it works? It's used to find a max number in an array. However, i cant visualise how the line for "temp2" works. Does the function updates temp1 to the largest integer in the array compared each time?

Code:
```int findmax(int array[],int n)
{
int temp1;temp2;

if (n==1)
return array[0];
else {
temp1 = findmax(&array[0],n/2);
temp2 = findmax(&array[n/2],n-n/2);
return temp1>temp2?temp1;temp2;
}
}```

4. Code:
```	enum Day {zero, one, two, three};
int day1;
day1 = one;```
PJYelton, I think he was asking why you anyone should bother declaring a variable of type Day when you can just declare it as an int and use the enum values anyways.

I actually don't know for sure, but I imagine maybe it's because if you do this:
Code:
```enum Day {zero, one, two, three};
enum Hour {one, zero, three, two};
int variable = one; //What gets assigned to variable?```
Just a guess, since I never use enums anyways

5. i get it...
Code:
```enum Day {zero, one, two, three} day1;
enum Hour {one, zero, three, two} hour1;
day1 = zero;
hour1= zero;```
so day1 will have value of 0 while hour1 will have value of 1, right?
Beside that, i hope someone can help me on the recursive function. Thanks for the help so far.

6. Oops, I misunderstood what you were asking. I don't use enums that often, but I'm 99% sure that
Code:
```enum Day {zero, one, two, three} day1;
enum Hour {one, zero, three, two} hour1;```
is illegal and won't compile, the same enum value can't be used more than once. As for why you would declare a variable as an enum instead of an int, same as I said above, code readability. If you declare day1 as an enum of type Day, then there is no doubt for anyone who reads your code (including you three months from now when you forget what is going on in the code) exactly what you are doing and what day1 is meant for. Declare it as an int and it can get confusing. In a small program it isn't likely to be a problem, but imagine a 10,000 line program. So in the end it doesn't matter, but declaring it as an enum just makes it easier on the eyes and the mind. Plus, I wouldn't be completely surprised if some old compilers gave you errors if you tried this.

As for the recursive function, temp1 looks for the max in the first half of the array, temp2 looks at the second half of the array, and the function returns whichever is greater. The best advice would be to use a paper and pencil, create a small unsorted array of like say 10 integers, and just go step by step through the funciton keeping track of all variables and recursion levels. This will help you to understand it far better than anything we could explain.

7. Namespaces can be a solution:
Code:
```#include <iostream>
using namespace std;

namespace Day
{
enum Day {zero, one, two, three} Day1;
}

namespace Hour
{
enum Hour {one, zero, three, two} Hour1;
}

int main()
{
Day::Day1 = Day::one;
Hour::Hour1 = Hour::one;
cout << Day::Day1 << " " << Hour::Hour1 << endl;

return 0;
}```