Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <pthread.h>
- #include <unistd.h>
- #include <string.h>
- void* print_message( void *ptr ){
- char *message;
- message = (char *) ptr;
- int end;
- end = strlen(message) - 1;
- int x;
- for (x = end; x >= 0; --x) {
- printf("%c", message[x]);
- }
- return NULL;
- }
- int main(){
- pthread_t thread1;
- char *message = "Hello World!";
- if (pthread_create( &thread1, NULL, &print_message,
- (void*)message)){
- fprintf(stderr,"thread error\n");
- exit(1);
- }
- sleep(1);
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement