[A89] Re: A problem


[Prev][Next][Index][Thread]

[A89] Re: A problem




Hi!

| ya, here is the code:
| void start_engine(int x, int y)
| {
|          int (*testmap)[x]= NULL;
|          testmap = calloc (y, sizeof (*testmap));
|          ... More code here
| and then it is used like a normal array. It was in the faq, where i should
| of looked first.

How big are x and y, usually?  They might have been too big to reserve space
for them on the stack.

| now, here is a question i have, why a pointer?

Because it's more general.  Arrays are, in fact, passed as pointers (yes, I
have learned).  I don't know if it would still work if you passed a string
from a char* variable.  It might.

| and I can't have it be a const, as i
| might have to change it when it goes on.

That's no problem.  Remove the const.

Bye,
Sebastian





Follow-Ups: References: