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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:13:32+00:00 2026-05-25T16:13:32+00:00

Though we declare a function with an integer array, we pass address of the

  • 0

Though we declare a function with an integer array, we pass address of the array to the function. In the case of simple integers it gives error if we pass address we get pointer conversion error. But how its possible in case of an array

#include<stdio.h>
void print_array(int array[][100],int x, int y);
main()
{
    int i,j,arr[100][100];
    printf("Enter the array");
    for(i=0;i<2;i++)
    {
        for(j=0;j<2;j++)
        {
            scanf("%d",&arr[i][j]);
        }
    }
    print_array(arr,i,j);

}

void print_array(int array[][100],int x,int y)
{
    int i,j;
    printf("\nThe values are\n");
    for(i=0;i<x;i++)
    {
        for(j=0;j<y;j++)
        {
            printf("%d",array[i][j]);
        }
    }
}

My question is even though our function is declared as one with integer array as first parameter (here) we are passing array address when we call the function. How does it function?

  • 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-25T16:13:32+00:00Added an answer on May 25, 2026 at 4:13 pm

    Your are passing the array, not its address.
    arr is an int[][] array
    (in fact it is pretty the same as &(arr[0]), which is a pointer to (the address of) the first line of your array. In C, there is no practical difference between an array and the corresponding pointer, except you take it’s address with the & operator.)

    Edit: Ok, just to make me clear:

    #include <stdio.h>
    
    int fn(char p1 [][100], char (*p2)[100])
    {
      if (sizeof(p1)!=sizeof(p2))
        printf("I'm failed. %i <> %i\n",sizeof(p1),sizeof(p2));
      else
        printf("Feeling lucky. %i == %i\n",sizeof(p1),sizeof(p2));
    }
    
    int main()
    {
      char arr[5][100];
      char (*p)[100]=&(arr[0]);
      fn(arr, arr);
      fn(p, p);
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

declare function Error:toString($this as javaObject) as xs:string external; the previous binds a return String()
If I declare an object in my header file, I get a compilation error.
Even though it is possible to write generic code in C using void pointer(generic
I am getting this error: DataError: (DataError) invalid input syntax for integer: 1.50 CONTEXT:
There is a JDK function that, although the javadocs does not declare it as
there is something i still don't get. for every class i declare there is
I would like to be able to declare a function as void foo(<any value
Has anyone seen this error when trying to call an external C function from
Though it's debatable, I've heard the majority of CSS developers prefer multi-line because of
Though it's on the edge of programming questions, I think this is still relevant

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.