...

/

Discussion: On the Case

Discussion: On the Case

Execute code to understand the output and gain insights into bitwise operators ( | , & ).

Run the code

Now, it's time to execute the code and observe the output.

Press + to interact
#include <stdio.h>
int main()
{
char a;
for( a='A'; a<='Z'; a++ )
putchar( a | 0x20 );
putchar('\n');
for( a='a'; a<='z'; a++ )
putchar( a & 0xdf );
putchar('\n');
return(0);
}

Understanding the output

Two lines are output:

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Code output

The uppercase letters are converted into lowercase. ...