Are the expressions arr and &arr same for an array of integers?

Showing Answers 1 - 7 of 7 Answers

Purvi mehta

  • Nov 8th, 2006
 

Ans:- No,&arr will store the address of array.

  Was this answer useful?  Yes

yuvraj

  • Mar 13th, 2007
 

The answer is YES bcoz both arr and &arr gives the base address of an array.
You can try it by a simple example
void main()
{
 int arr[10];
 printf("%dn",arr);
 printf("%d",&arr);
}

  Was this answer useful?  Yes

Jyotiranjan Moahnty

  • Oct 8th, 2007
 

#include<stdio.h>
int main()
{
 int arr[2];
 printf("%dn",arr);
 printf("%dn",(arr+1));
 printf("%dn",&arr);
 printf("%dn",(&arr+1));
}
 

Try it, I think it is the better example for you to understand that, arr and &arr is not same. Their starting address is same, but the value in that memory is not same.

I think you are a student. I appreciate, your involvement with this  kind of things.

  Was this answer useful?  Yes

KishoreKNP

  • Dec 4th, 2009
 

Arr and &Arr both are same, which will return the address of first element of the array. For example

void main()
{
   char arr[10] = "Kishore";
   printf("n%u : %u", a, &a);
}
Output:
~~~~~

65516 : 65516

  Was this answer useful?  Yes

Mohamed

  • May 8th, 2013
 

Actually arr and &arr are different.
arr holds the base address of the array arr[], but &arr holds the address of the entire array.
but both expressions points to the same base address.

Code
  1.   #include<stdio.h>

  2. "%u

  3. ""%u

  4. ""%u

  5. ""%u

  6. "

  Was this answer useful?  Yes

ruphaensil

  • Dec 31st, 2013
 

error...because a is undefined

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions