CC++Server Side ProgrammingProgramming

In this tutorial, we will be discussing a program to understand thread functions in C/C++.

Thread functions allow users to implement concurrent functions at the same time, which can either be dependent on each other for execution or independent.

## Example

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
void* func(void* arg){
}
void fun(){
printf("This line may be printed before thread terminates\n");
else
//waiting for the created thread to terminate
printf("This line will be printed" " after thread ends\n");
}
int main(){
fun();
return 0;
}

## Output

This line may be printed before thread terminates
This line will be printed after thread ends