Can a pushbutton be connected between a digital input and a digital output ?

Hi all
I've discovered this probable hardware related issue while I was developing my project.
Since it is a multiplexing application, I can't feed the contacts with constant 5V, therefore the digital outputs must serve to generate the 5V signal for contacts' state detection by the digital inputs. But it doesn't work, the HIGH state of the digital input never shows up in this configuration. I am using an Arduino Mega 2560.

Since I usually don't make myself clear in English, there are some illustrations of the issue:

EDIT: well, it is yet another pull-down resistor issue by a newbie. Consider this question solved…

Is there any explanation for this ? Will I need an additional device to command 5V supply for my contacts ?

Thanks in advance.

If you consider the keypad.h library, that is exactly the case of output pins driving input pins.
Say there was a 4x4 matrix.
4 outputs, 4 inputs.
The outputs are normally high, the inputs have internal pullups connected.
To scan the keypad, 1 output is driven low, the 4 inputs are read - if a button is pressed, one input will read low. You know which output was low, you know which input was just read, so you know which button was pressed.
1st output is then driven back high, the 2nd output goes low, and the inputs are read again.
Same for output 3 and then 4.
Does that help?

I tried to edit my post to inform that I've learned that it was a pull-up/pull-down resistor related problem, but I failed to save.
Your answer confirms that, consider the problem solved.
I feel so noob in electronics…

Every one starts somewhere ...