Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9309497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:52:48+00:00 2026-06-19T00:52:48+00:00

I am using Eclipse C/C++ IDE on Ubuntu and am trying to define a

  • 0

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

segmentation fault

.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T00:52:49+00:00Added an answer on June 19, 2026 at 12:52 am

    Just what I suspected. Two-dimensional arrays ain’t double pointers.

    void fill(char p[3][3])
    {
        int i, j;
        for (i = 0; i < 3; i++) {
            for (j = 0; j < 3; j++) {
                p[i][j] = ' ';
            }
        }
    }
    
    int shmid = shmget(2000, sizeof(char[3][3]), 0);
    char (*shmPtr)[3] = shmat(shmid, 0, 0);
    fill(shmPtr);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I refer to this link: http://blog.sudobits.com/2011/10/02/how-to-install-eclipse-ide-on-ubuntu-11-10/ I installed eclipse using this command: sudo apt-get
I am trying to create an android project using eclipse IDE,its created successfully but
I'm using eclipse IDE Galileo fine on Ubuntu 10.04.(with JRE in the eclipse root
I am working on a project using Eclipse(IDE) where i am getting this error
I'm trying to write a simple C program on Ubuntu using Eclipse CDT (yes,
I made this small Java program using eclipse IDE. I have set the workspace
I am trying to create a sample JMS application using Eclipse IDE. I have
I am using Ubuntu and Eclipse as an IDE for C/C++. I currently have
I'm using Eclipse IDE on Ubuntu. My app offers encryption services and I want
This is my first Java application I am creating (using Eclipse IDE) and the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.