Don't worry about accidental flirting, I would hope (Well, if you have a paranoia of getting punched in the face by insecure guys, you might worry). Flirting is another way of referring to interacting with people you like, kind of like how chatting is talking, but less formal.
But some ideas (which are not applicable in all settings):
Flirting is....
-Talking to someone out of a group of people, without talking to anyone else in the group
-Making suggestive/dirty comments and jokes in a playful manner
-Touching hand/arm/neck/face or hair
How you know if you are flirting with someone successfully is usually either a body-language thing (which is difficult to describe in writing without going into treatise format), or if they start giggling/laughing.