2

I'm studying a function to search for a number where that goes as the following..

int sequential_search (int num, int a[], int size);

And in main , a is defined as the following.

int *a;
a = new int[size];

So I was wondering if its the same thing.. Thanks in advance

AliciaBytes
  • 7,300
  • 6
  • 36
  • 47
Wall-ED
  • 51
  • 5

1 Answers1

4

When used as function parameter then there is no difference.

int sequential_search (int num, int a[], int size);  

is equivalent to

int sequential_search (int num, int *a, int size);  

Otherwise both are different: int x[] declare x as an array of ints while int *x declare x as a pointer to int.

haccks
  • 104,019
  • 25
  • 176
  • 264