Query related to Access modifiers

In the CPP Data Modifiers video at 5:06 as said we can use 2 Access modifiers in same variable so my queries are:

  1. can we use more than 2 access modifiers in same variable? if not why?
  2. Further in video as said we can use like
    signed long long int , can we use singed unsinged int or short long int or short lolg long int ?

Hello @idontknowhowtocode,

Datatype Modifiers are used with built-in data types to modify the length of data that a particular data type can hold. Data type modifiers available in C++ are:

  1. Signed: To store negative values also
  2. Unsigned: To store only positive values.
  3. Short: To shorten the range of values that int can hold.
  4. Long: To increase the range of values int can hold.

Yes, we can use two access modifiers with the same variable.
But, you can neither use 1. and 2. together nor 3. and 4. together.

so,
short unsigned, long unsigned, short signed and long signed are permissible only.

Hope, this would help.
Give a like, if you are satisfied.

Hello @S18ML0016
Thank you for your response. :slight_smile:

i am still confused for my 1st question " Can we use more than 2 access modifiers in same variable? if not why? " Does C++ forbids that?

Hey @idontknowhowtocode,

As i have answered in my previous reply, Yes you can use two access modifiers for same variable
and i also gave examples also.
There are only four cases where you can use 2 access modifier as specified in my last reply.

unsigned long a=10;
unsigned is one modifier and long is another used for variable a.

To better understand these combinations of access modifiers, read there usage or definition i have explained in the previous reply.

Let me know, if you still face any issue.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.