Write a C function that implements a 3-bit mux, following the pattern I showed in class. Remember: &&, || and ! are used to represent the logic gates. For testing, your program should behave as follows:

three control bits: 1 1 0
eight inputs: 0 0 0 0 0 0 1 0
answer: 1

The user types control bits 110, or 6, and the program returns
the 6th input - which is the only 1.

I am NOT asking for the code. I just am confused what it wants me to do. I was not able to attend this class. How does it get 1 as the 6th input. looks like the 6th input is 0 and the 7th is 1.

I am not really familiar with mux. Any help would be greatly appreciated.

Recommended Answers

All 2 Replies

Bit fiddlers generally start counting at bit 0. (Which does have a nice symmetry with arrays being zero based too.)

[edit]Are you familiar with things like & , | , ~ , >> , and << ? I'd bet they'll be your basic 'tools'. I'm wondering what else was missed (by me) if the instructions mention the logical ops.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.