Scaling an analog signal

I am new to this and my question is this:
If I have an analog input with a potentiometer, the voltage will vary from 0 to 5 volts.
I have a variable of type int.Which varies from 0 to 1023.

How do I scale the range from 0 to 1023 to any range I need, for example from -10 to 40 units?
Which is the code?

Or how can I scale the analog input signal to the range of values ​​I may need?

Thanks in advance.

Look at the map() function

Thanks UKHeliBob, I'll try.