User defined variables with JMeter can be defined at various levels.
1.At a Test Plan level adding here will result in using the variables across the thread groups it could range from variables to passing the csv file.
Here's the screen shot :
2.At a Thread Group level by adding a pre processor > User parameters.
This is usually used when you want to iterate through 'n' users it is preferred to read from a external file if the data is massive.
However let me show you details on how to add a user,delete a user ,add variable & delete a variable.
When we add at a thread group level it acts global to that thread group & all those samplers within that thread group.
3.Sampler Level by adding a pre processor > User Parameters.
Adding user parameter at sampler level is more like a local variable to that sampler.
It is accessed by right clicking on the sampler >> pre processor >> user parameters