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

  • Home
  • SEARCH
  • 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 4061158
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:25:53+00:00 2026-05-20T15:25:53+00:00

For the assignment I am working on, I am required to use functions to

  • 0

For the assignment I am working on, I am required to use functions to manipulate data in an array of strings. So really, an array of arrays of chars. I define the array like so:

char strings[5][100];

So there are presumably 500 contiguous chars in memory. The function I have defined looks like this:

void foo(char *labels[100]);

I think I might have some syntax issues here, but what I think this is doing is saying, “I’m a function that expects a pointer to an array of 100 chars.” So labels* would point to the first array of chars, and (labels + 1)* would point to the second, and so on. I am calling the function like this:

foo(&strings[0]);

What I think this is doing is grabbing the address of the first array of chars in strings. The error message I’m getting tells me the function expects char ** but the argument is char (*)[100]. This is confusing to me as nowhere did I specify that there be a pointer to a pointer of a char.

Any help is greatly appreciated, or if you could pointer me in the right direction :)

  • 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-05-20T15:25:53+00:00Added an answer on May 20, 2026 at 3:25 pm

    strings is a two dimensional array. So it decays to char(*)[100] when passed to a function. Instead you can have the prototype like –

    void foo(char labels[][100], int row); // `row` decides which param to access.
    
    void foo(char labels[][100], int row)
    {
        for(int i = 0; i < 100; ++i) // If you need, modify all the 100 row elements
        {
            labels[row][i] = 'a'; // Modifying like this
            // ....
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a homework assignment in which I'm required to use char arrays
I've been working on a class assignment for C++ and we're required to acquire
I'm working on an assignment that is telling me to assume that I have
I'm currently working through an assignment that deals with Big-O and running times. I
I'm working on a problem which we have to use semaphores to solve. I
I'm working on a memory pool for a small game engine. The main use
I'm working on a homework assignment for CS1, and I almost have it finished
I am currently working on a homework assignment and I am thoroughly stuck. I
Ok, I am working on an assignment for school, and I set up my
Ok, so I am working on a homework assignment, and I am using SWING

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.