To get started, find a professor at your university whose work sounds interesting to you, read over a paper of theirs, and ask to meet with them. This meeting may lead to a research opportunity, or at least help you to learn more about the process of research. You don’t have to worry about bothering your professors, either—every professor I’ve met with has been happy to talk to me about their work.
It’s okay to be frustrated.
I don’t hear this mentioned often, but frustration and programming are inextricable. Your code can be completely correct but fail to run properly because you were using an older or newer version of some technology, or because an installation didn’t work correctly—or you could just be confused about how something works. Sometimes you figure out your program’s problem, and it’s a fantastic feeling. Other times, you can’t, and that’s when you should seek help (see my “2 hour rule” mentioned above.)
If you’re fairly sure that your issue is a bug, and you’re not sure how to approach figuring it out, there are some things you can do. Often the thing that helps me the most when I’m feeling stuck is making something with pencil and paper: sometimes it’s a flowchart, sometimes it’s a drawing of part of an array, and sometimes it’s annotated pseudo-code.
Another thing that can help is to describe your problem out loud to yourself or someone else. In doing so, you’ll most likely find yourself thinking about your code in a different sort of way. This may be enough to solve your problem. If you do end up needing to ask for help (be it from a TA or coworker), having practice describing or diagramming your issue will be useful. The reality of coding, and of majoring in Computer Science, is very different from what I had imagined it to be: it’s far more difficult and far more rewarding than I had thought. Hopefully, these things I wish I knew when starting out will prove useful to you!