Professional Documents
Culture Documents
Shared Memory Program1
Shared Memory Program1
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/shm.h>
#include<string.h>
int main()
int i;
void *shared_memory;
char buff[100];
int shmid;
printf("Process attached at %p\n",shared_memory); //this prints the address where the segment is
attached with this process. %p is a format specifier used for printing pointers
Receiver Program
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/shm.h>
#include<string.h>
int main()
int i;
void *shared_memory;
char buff[100];
int shmid;