# I don't understand pointers & arrays. Keep getting error in compiling

This is a discussion on I don't understand pointers & arrays. Keep getting error in compiling within the C Programming forums, part of the General Programming Boards category; Here is my code: Code: #include <stdio.h> #include <stdlib.h> #include <math.h> #define DIMENSION 3 #define SIGN(i, j) pow(-1, i+j) double ...

1. ## I don't understand pointers & arrays. Keep getting error in compiling

Here is my code:

Code:
```#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define DIMENSION 3
#define SIGN(i, j) pow(-1, i+j)

double det(double entries)
{
int dim = DIMENSION;
int k, l, m;
double submatrix[dim-1][dim-1];
double det;

det = 1;

if(dim == 2)
{
det = ( (entries[0][0]) * (entries[1][1]) ) - ( (entries[0][1]) * (entries[1][0]) );
return det;```
What I don't understand, is that I keep getting the error message "subscripted value is neither array nor pointer" for the line:
Code:
`det = ( (entries[0][0]) * (entries[1][1]) ) - ( (entries[0][1]) * (entries[1][0]) );`
Can someone explain what I've done wrong? What is the 'subscripted value'

2. Code:
`double det(double entries)`
Notice how there are no [ brackets ] after entries? That means there is just one double, not an array of doubles, or a 2-d array of doubles. So when you do entries[0][0], you're trying to treat a double like a 2-d array of doubles, which is a no-no. See if this helps: 7.2 Passing Arrays to Functions.

EDIT: This link may be better: http://c-faq.com/~scs/cclass/int/sx9a.html.

3. Ah! thats annoying. So is there no way to pass a multi-dimensional array to a function without saying any of its dimensions?

4. Thanks, got it sorted now