Store more than one value in a variable with &&

4

Can I store more than one number in a variable? For example:

m= a&&b&&c&&d&&e

I need to indicate which is the largest and the smallest number that the user entered, wanted a way to do this without having to test one by one.

    
asked by anonymous 03.04.2018 / 16:02

1 answer

5

Answering the question: It is not possible. Variable is just a name for a memory location where one and only one value .

It is possible to have a variable with a set of variables, it is called array , then the contents of these variables are the elements contained within it, but the set of elements as a whole is considered a value. And each element is a variable that has only one value.

You can make calculations that can transform multiple values into just one. Just as you can 1 + 2 + 3 turn 6.

Bitwise is usually done with & , | and ~ . In general it is harder to understand, not all cases outweigh use.

To know what to use we would need to understand the problem better. But from what I reported it seems to have to compare one by one, the way to compare is that it can change.

    
03.04.2018 / 16:12