FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Programming in C problem





carlospro7
I'm farly new to C and am working on this problem. First of all, is it possible to point to arrays using pointers? Is it possible to point to a full array?? (meaning all the variables in the arrays, as opposed to just one - i.e. x[10] )

Well, I honestly dont know so i thought id give it a try, and I get this one error message:

proj4.c: In function 'main':
proj4.c:23: warning: passing argument 1 of 'main_menu' from incompatible pointer type

And this is my code:
Code:

//#define MAX_SIZE 200
//#define MIN_SIZE 2
int main ()
{
   int x[MAX_SIZE];
   int cur_size = MAX_SIZE/2;
   main_menu (&x, &cur_size);
   return 0;
}



the prototype for the main_menu function is:
Code:

void main_menu (int *a[], int *psize);


Any help would be greatly appreciated. Thanks
eepman
An array is already a pointer. This means that you do not need the & reference in the passing, and you do not need the brackets [] in the main menu prototype. I think that will work.
carlospro7
ok it worked, thank you!
Related topics
Is that allowed?
Programming links, info, and tutorials
C Tutorials
C++
C++, simple things???
call by reference (C++)
Game making - anyone interested?
How to devlope own games?
Artificial Intelligence
Beginning Programming... Help!
I am looking for some advice
Simple menu written in C - Problem with loop
Win32 C++ problem
Is Completeing a BS in Computer Science Difficult?
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.