Ideally each Stack Exchange site is designed to have a unique scope and focus, though there will inevitably some overlap between some sites at the edges of said scope. There is also overlap where a new site is proposed to cover a specific topic that it partially covered by an existing site.
However, for Stack Overflow and Code Review the sites are meant to be distinct. At one level you could say that Stack Overflow is for broken code ("why doesn't this work", "why does this give the wrong result?" etc.) as well as for certain "how do I do this?" type questions. However, Code Review explicitly states that you must have working code, as their primary goal is to make code "better" (eg. faster, use less memory, etc.)
So, if you have working code but want to make it better post on Code Review.
However, if you have broken code post on Stack Overflow.