What is the definition of a variable as opposed to a constant? I was trying to figure it out the other day. First I thought that a constant must only take 1 value (e.g. if $x+1=0$, then $x$ must be a constant) and a variable can take any of several values (e.g. if $y=x+1$, then $x$ is a variable because $x$ can be any of $\{x \mid x \in \Bbb R\}$). But then I thought that when doing integrals we often get a constant $C$ in our equations, which could potentially take any value -- and thus makes our solution actually a class (or set or something) of solutions.
So what actually IS the definition of a constant vs. a variable?
It is a matter of perspective really. If we look at the physics formula: $E=mgh$ we see three letters in this equation.
Suppose we are on earth and we are looking at an object of mass $2$kg. We would like to know the value of $E$ for different values of $h$ (height). So $h$ acts as the variable and $m$ and $g$ are constants. Because we are considering the hypothetical situation were $m$ and $g$ are known. In this particular case $E(h)=2\cdot9.81h$.
Now suppose we are on earth again, and consider dropping something from a height of $3$m. We would now like to know the value of $E$ for different values of $m$. Now $m$ acts as the variable and $h$ and $g$ are considered constants. Because we are considering the hypothetical situation were $h$ and $g$ are known. In this particular case $E(m)=3\cdot9.81m$.
Likewise we could make $E$ a function of $g$, with $m$ and $h$ constants.
So it all comes down to what you assume to be known information. Any thing that isn't known is unknown/variable, within the context.
Of course if you would like to, you could even see $E$ as a function of three variables: $E(m,g,h)$. It all depends on what qualities of $E$ you want to describe.
For your integral example: we say $\int 2x\,dx=x^2+C$, with $C$ a constant. That is because we say that $\int 2x\,dx$ is a function whose derivative is $2x$.
You can interpret the phrase $\int 2x\,dx=x^2+C$ in the above way, saying something like this: