Let's assume the usual situation of a shell running on a terminal. All of stdin, stdout, stderr of the shell are connected to that terminal, and
reading from one reads input from the user, and writing to one prints stuff for the user to read.
Now, when the shell launches a command, that one also has all of the fds connected to the terminal. Same for the next command the shell launches. Like so:
+---------------+ +---------------+
| first cmd | | other cmd |
|stdin stdout | |stdin stdout |
+---------------+ +---------------+
| | | |
| | | |
| | | |
[------------------ tty -----------------]
Now, you said:
my first thought is to change the second process stdin with stdout of the first one
but if you were to swap two of the fds above, the result would be no different, all the fds were connected to the tty before, so all would be connected to the tty after any swap.
Now, if you meant detaching one of the fds from the tty side, well, that's not really how it works. Fds are more like pointers to kernel data structures, and an fd pointing to a tty is different from an fd pointing to a pipe or a network socket. Or, to look at it another way, an fd is just the process side of a "connection" between a process and the OS.
So, you need another sort of an fd, one that connects to another kind of thingy on the OS end. For example, a pipe. A pipe still isn't a connection just between the two processes, but two connections between the process(es) and the OS:
+---------------+ +---------------+
| first cmd | | other cmd |
|stdin stdout | |stdin stdout |
+---------------+ +---------------+
| | | |
| | | |
| [-w-- pipe driver -----r-] |
| |
[------------- tty driver ---------------]
(Note that I assumed above that the tty fds are all open for reading and writing. That's how it is on the Linux systems I've looked at, so it is actually possible to write to stdin, or duplicate an stdin fd to stdout. If they're opened in read-only / write-only mode, then that doesn't work. AFAIK Linux pipes are always one-directional, and have a distinct read-end and a write-end.)