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 7785099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:12:05+00:00 2026-06-01T20:12:05+00:00

Programming in C ( with -std=C89), and running into errors trying to pass a

  • 0

Programming in C ( with -std=C89), and running into errors trying to pass a character string array into a function.

In main(), I’ve declared the array as follows:

#define ROWS 501
#define COLS 101
void my_function( char **);
...
char my_array[ROWS][COLS];
...
my_function(my_array);

In my_function, I’ve declared the array as:

void my_function( char **my_array )
{
...
}

I’m getting this error:

warning: passing argument 1 of 'my_function' from incompatible pointer type,
note: expected 'char **' but argument is of type 'char (*)[101]

  • 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-01T20:12:06+00:00Added an answer on June 1, 2026 at 8:12 pm

    A two-dimensional array of characters is still a character array and would have a prototype of char *my_array. So just change your function definition to this:

    void my_function(char *my_array)
    

    Note that this will flatten the array. There are different techniques to keep the two-dimensional-ness of the array, an easy way is to use this alternative prototype:

    void my_function(char my_array[][COLS])
    

    Which will preserve your array’s dimensions when passed.

    char **my_array means something completely different (pointer to an array, for example).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am newbie to programming and I am trying to pass an array into
I have this code from programming pearls #include <iostream> //#include <string> using namespace std;
I'm doing some programming practice right now by trying to sort a 2D array
Benefits of C++11 std::array s when programming have been explained by experts, but there
I'm trying to get into C++ programming, and I'm quite struggling against the little
I've been trying to get into C++ programming with Eclipse, but I'm having problems
While I like programming in C++, I hate the idea of: std::basic_string vs QString
I am trying to make the programming challanges from the book written by Steven
Just started programming in C++. I've created a Point class, a std::list and an
I am trying to expand my template programming skills and I am facing a

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.