i want to create program with a size 10 and then create and array and put the values entered thru keyboard and store it.here it asks the user to enter the size of the array and then enter integer numbers.

consumer we have to get the array and print it in the consumer


can somebody PLZZZZZZZZZZZZZZZZZZZZZZZZZZZ HELP MEE





#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<stdio.h>

#define SHMSZ 10

main()
{
int a;
int shmid;
int *shm;
key_t key;
int u;
int i;
printf("enter array size\n");
scanf("%d",&u);


int* arrray=(int*) malloc(sizeof(int) * user);

key = 1234;

if((shmid = shmget(key,SHMSZ, IPC_CREAT | 0666)) < 0)
{
perror("shmget");
exit(1);
}

if((shm = shmat (shmid, NULL, 0)) == (int *) -1)
perror("shmat");
exit(1);
}




a =shm;

for(i = 0; i<user;i++)
{ scanf("%d",&a);
array[i]=a;
}

*ar = NULL;

while(*shm != '*')
sleep(1);

exit(0);

}