Javatpoint Logo
Javatpoint Logo

C++ bitset flip() Function

C++ bitset flip() function is used to flip all the bit values converting zeros to ones and ones to zeros. If a parameter 'position' is passed, it flips the bit at the specified position only.

Syntax

Consider bitset 'bs' as an object.

Parameter

pos:It takes one parameter 'pos' but it is not mandatory.

Return value

It returns a new binary representation number.

Example 1

Output:

1010

Example 2

Output:

1101
001010
Next TopicC++ bitset



Help Others, Please Share

facebook twitter pinterest