Sometimes, when answering SO questions, I am using in my answers the code which strictly speaking is not mine. I mean I have used this code in my applications, and often I have altered it more or less significantly, however I wasn't the author of the code, usually I found it somewhere on the Net.
So the question is: should I mention this fact in my answer? And, if I remember where the code came from, should I just refer the user to this site?
From one side I feel like giving an answer with code in place is much more helpful than just giving a link, however from another side I feel like "stealing" the credit.
EDIT: I am not speaking about the code taken from the open source projects or sites like CodeProject, where it is very clear where the credit goes, I am speaking about code snippets and solutions found on forums or sites like SO.
For example, OP asks how to add some functionality to his/her program, and there is a very specific API for doing so, does it matter that I came across this API on a site that is not Microsoft/Apple/Adobe etc. itself?