I am using Eclipse C/C++ IDE on Ubuntu and am trying to define a 2D of char as a shared memory between a parent-child processes and am using this :
void fill(char **p)
{
printf ("int i=0;\n");
int i=0;
printf ("int j=0;\n");
int j=0;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
p[i][j]=' ';
}
}
}
int shmid;
char **shmPtr;
if(shmid = shmget(2000, sizeof(char[3][3]), 0)!=-1)
{
shmPtr = shmat(shmid, 0, 0); //attach shared memory to pointer
fill(shmPtr);
}
Is this the right way to define the array or not? While trying to fill this array I get a
shmid? Keep in mind that 2D arrays != double pointers.