Solved

what is the use of " | " in c language?

Posted on 2011-02-24
3
348 Views
Last Modified: 2012-05-11
char x;
char y;
char z;
z= x | y;
I was wondering what is the use of " | " in c language, does it add bits?

0
Comment
Question by:logicallayer
3 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 125 total points
ID: 34969238
the result is the bitwise inclusive OR function of its operands.
0
 
LVL 33

Assisted Solution

by:sarabande
sarabande earned 125 total points
ID: 34969331
the bitwise or means that any bit set in either operand x or y would be set (1) in z.

contrary logical & is bitwise and and z would have only those bits set which were both set in x and y.

Sara
0
 

Author Closing Comment

by:logicallayer
ID: 34969473
now it make sense, as I was going through a code of friend and this totally explains it...

thanks for both of you.
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question