What does the following code do in the find.c source code in pset3
const int MAX = 65536;
Does it define a constant MAX with value 65536?
If so, then is this same as writing : #Define MAX 65536
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
No they are not the same:
#define MAX 65536:
This tells the compiler to swap all instances of MAX with 65536, it is not not a variable that exists in memory.
const int MAX = 65536:
This declares a variable
MAX of type
int that contains the value
const keyword tells the compiler that this variable must not and will not be changed, its value is constant for the remainder of its lifetime.
You might want t have a look the links below for more detailed info on this topic.