Question

If I do this:

typedef int x[10];
x a;

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

Was it helpful?

Solution

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

OTHER TIPS

Yes.    

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top