Self-written Mutex for 2+ Threads
Broken
If you call enterLock() with id 0 followed by enterLock() with id 1 (on another thread perhaps), both calls will succeed.  Since your function doesn't change the state of the mutex, it isn't surprising.  Perhaps you meant to leave lock-&gt;waiting[id] at 1 instead of 0?  Note, even if you did that, it wouldn't be enough to fix the mutex.
Also, what is the turn variable used for?
Spinlock, not mutex
Technically, what you are doing is a spinlock.  A real mutex should efficiently wait for its turn instead of spinning in a loop.