Why not? Because, under the terms of use of StackOverflow, all posted code is licensed under a CC BY SA license.
You could, I suppose, add a CC BY SA acknowledgement to both StackOverflow, and the person who posted the code for every snippet of code you copy from StackOverflow in license notifications in your own project. You must acknowledge both. But you know you won't.
Instead, you will rely on the goodwill of every corporate overlord who will ever own StackOverflow, or inherit its copyright assignments for one Mickey Mouse copyright lifetime. Which seems unwise given that the current corporate overlords don't seem to be trustworthy. And seems particularly unwise now that the Millennial internet is passing away.
There was some discussion about allowing authors to post code under a dual-use license when StackoverFlow first converted their terms of use to require CC BY SA licensing. But whenever I add dual-use license notifications to my StackOverflow posts, StackOverflow moderators keep editing it out without my permission!
If the answer links to code on another site, then that code isn't covered by the StackOverflow terms of use.