I am using the unreal engine that supports c++ language. Now I don't know anything about copyright and I don't know how to know anything about it. I live in Egypt. I worked on a game for 8 months. The problem is that I used the Ben10 character and I do not know if this is legal or not. I am afraid that something bad will happen to me
If I lock you in a room without access to anything and tell you "Write a novel" and you write a novel with characters, you have copyright in the work. But it's not absolute:
If you use your own characters, you own all the copyright in the work, but not in the idea, as ideas are not copyrightable, see Feist v Rural.
If you use someone else's characters extensively (as in more than a short hommage/cameo), you very likely make a derivate. You own a copyright in your part, as in the expression of the story or pictures you created, but you do not gain property interest in the existing characters' expression. Since the copyright to the characters lies with the owner of their IP, you need their OK to release (and also to even make) your work - as with the owner of a copyright is the sole right to decide on distribution and creation of derivates under 17 USC § 106 (2).
Also remember that making an unlicensed derivate work risks having nothing you can sue for in case the original copyright owner lifts your ideas and scenes-a-faire parts and adapts them for their own derivate, see Anderson v Stallone
The strange case of fanfiction chains...
Now, there is a strange situation when a work is based on a work which is based on a work... Then, publishers and editors start with red ink and the result is, that what people know as Twilight now has nothing to do with the fanfiction it started as (It wasn't Vampires in the original draft), and 50 Shades of Grey ended up striking any and all supernatural from it, despite it having been a Twilight fanfiction originally. By making own characters and own expression of the world, there could be no copyright infringement.
US law vs Egypt law?
Both Egypt and the US have signed the Berne convention, meaning that copyright is very very similar in the broad strokes that the right to allow or disallow derivates is with the copyright holder.
Also, since Ben10's copyright owners are to the best of my knowledge in the US (Cartoon Network Studios & Men of Action Studios), they will sue in a US federal court.
Using Ben10 characters without permission from the owners is not legal
Unless the characters you are using are either entirely of your own creation or public domain, you will fall foul of copyright law. Usually what happens is your game will be hit with a DMCA takedown claim (most websites follow US law no matter where you yourself are based) and you will be unable to distribute your game. If you try to fight your DMCA takedown notice, the owners have the opportunity to come after you using your country's own laws.