#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define SIZE 1
#define KEY 1234
int main() {
int id = shmget(KEY, SIZE, 0666 | IPC_CREAT);
if (id == -1)
char* ptr = (char*) shmat(id, NULL, 0);
if (ptr == (char*)(-1));
while (1) {
strcpy(ptr, "1234");
strcpy(ptr, "4321");
}
shmctl(id, IPC_RMID, NULL);
}