online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include<stdio.h> #include<pthread.h> #include <semaphore.h> sem_t flag; void fun(); void *threadfun(void *arg) { sem_wait(&flag); printf("in thread\n"); fun(); sem_post(&flag); return NULL; } void fun() { printf("function\n"); sem_wait(&flag); printf("wait\n"); sem_post(&flag); } int main() { pthread_t t1; void *res; sem_init(&flag, 0, 1); pthread_create(&t1,NULL,threadfun,NULL); pthread_join(t1,&res); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue