In short, go to stackoverflow.com
Searching Stack Overflow For Coding Solutions
Stack Overflow (SO) is a website dedicated to programmers asking and answering each other questions, and is a great place to start when looking for a solution to a particular problem with your code.
One of the most powerful attributes of SO is the accumulation of developers’ knowledge over time. Community members have contributed more than 18 million questions and 27 million answers. When a developer is stuck on a coding problem, they search through this vast trove of information to see if a solution to their particular conundrum has already been offered.
There’s a useful primer for searching effectively on SO here.
Software developers searching for answers might use natural language – “How do I insert an element array in a specific position?” – or they might choose a few important keywords relevant to the programming task at hand and use those as their query with the hope that the search engine would return the relevant solutions.
A lot of the time they find the relevant code, but don’t find a clear explanation of how to implement it. Other times they find a great explanation about how one might solve the problem, but not the actual code. This is why it is important to keep track of what you find as you look for answers.
Even if you don't find a useful answer elsewhere on the site, including links to related questions that haven't helped can help others in understanding how your question is different from the rest.
Here is another great link from Stack Overflow, on how and why to avoid “following a solution that seems close enough” by staying mindful throughout the process of researching.
Asking a question on Stack Overflow
If you've searched carefully for an answer to your question on Stack Overflow and can't find a useful answer, then it's probably time to ask a question for yourself.
This means creating an account on the site which can take a few minutes, but is well worth the time.
In particular, we love Stack Overflow’s How do I ask a good question? Article in their Help Centre.