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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:33:31+00:00 2026-05-22T18:33:31+00:00

Possible Duplicate: How do I use arrays in C++? i have a problem. i

  • 0

Possible Duplicate:
How do I use arrays in C++?

i have a problem.
i have to use auto darray(matrix).

const int size_m=10;
const int size_n=10;

void process(int *x)
{
  //i can pass array, all is well, i work as with dynamic allocated array
  for(int i=0;i<size_m;scanf("%d",&x[i]),i++);
}

void input_m(int **x) 
/*
mistake is here, 
a cause of my problem that i'm trying to work  with  matrix allocated in stack(auto matrix,local) as with dynamically allocated matrix.
i receive error like this : "cannot convert ‘int [100][100]’ to ‘int**’ in assignment" how should i pass it? 
*/
{
  for(int i=0;i<size_m;i++)
     for(int j=0;j<size_n;j++)
      scanf("%d",&x[i][j]);
}

int main()
{  
  int x[size_m];
  input(x);
  int matr_x[size_m][size_n];
  input_m(matr_x);
  return 0;
}

THANK YOU! it works.. it was so simple, as usual)

    const int sizem=3;
    const int sizen=3;

      void _input(int x[sizem][sizen])
        {

           for(int i=0;i<sizem;i++)
           for(int j=0;j<sizen;x[i][j]=1,j++);
         }

       int main()
         {
            int m=10,n=10;

             int x[sizem][sizen]={{1,2,3},{5,7,4}};

          _input(x);

           for(int i=0;i<sizem;i++)
            { for(int j=0;j<sizen;printf(" %d",x[i][j]),j++);
              puts("");
              }

          puts("");


           return 0;
               }
  • 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-22T18:33:32+00:00Added an answer on May 22, 2026 at 6:33 pm

    First of all, see the answer to this question. Your code should compile if you change void input_m(int **x) to void input_m(int x[size_m][size_n]) (assuming that both size_m and size_n are constants). Note that, as stated in the question that I linked to, “in general, to pass 2D arrays to functions you need to specify the array dimensions for all but the first dimension.”

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

Sidebar

Related Questions

Possible Duplicate: Escape string for use in Javascript regex I have a msg like
Possible Duplicate: Use SVN Revision to label build in CCNET I'm working through the
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: When to use “strictfp” keyword in java? What is the use of
Possible Duplicate: Internationalization in SSRS We use SQL Server Reporting Services for our web
Possible Duplicate: How can I use a carriage return in a HTML tooltip? I'd
Possible Duplicate: When should you use 'friend' in C++? I was brushing up on
Possible Duplicate: Cannot use concatenation when declaring default class properties in PHP? The following
Possible Duplicate: Cocoa Memory Management NSArray with Objects I have an NSMutableArray filled with
Possible Duplicate: C++ - enum vs. const vs. #define Before I used #define I

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.