tags:

views:

208

answers:

3

If I do this:

typedef int x[10];
x a;

Is it same as: int a[10]; ?

+4  A: 

Yes.    

unwind
so if I have int x[10]; int y[5]; Are they type equivalent in C?
tsubasa
(int x[10]) is only equivalent to (int y[10])
AlexKR
+3  A: 

Yes its same. If you want to learn more, go here.

Ravi
+for reference.
pst
Thanks pst.....
Ravi
+1  A: 

Yes if we speak about syntax. But think about this:

typedef int MyType[5];

/* Some code, large enough fragment */

int func (MyType var)
{
  /* Something that changes */
  return 0;
}

If you see only func() declaration you can think it receives var by value so any change inside function is local. But as actually MyType is array which is pointer changing var inside func() you can change actual caller's variable.

So speaking about concept this is not the same.

Roman Nikitchenko