Untitled

 avatar
unknown
plain_text
2 years ago
362 B
4
Indexable
#include<stdio.h>
#include<stdlib.h>
#include<sys/shm.h>
#include<unistd.h>
#include<string.h>
void main()
{
	char str[100];
	int shmid=shmget((key_t)2366,1024,0666|IPC_CREAT);
	printf("Key of shared memory is %d\n",shmid);
	void *shm=shmat(shmid,NULL,0);
	printf("Process is attached at %p\n",shm);
	printf("Value read from shared memory is %s\n",(char*)shm);
}
Editor is loading...