> I am writting a program for a class and my tutor says that declaring a pointer to an array will make the program run better.
You haven’t told me the context of the code, but I get a bad feeling with such a statement? Pointers make your program run better? What kind of statement is that?
I recommend you read up your book on pointer notation. No book? See http://www.cprogramming.com/tutorial/c/lesson6.html
2007-07-09 07:47:03
·
answer #1
·
answered by csanon 6
·
0⤊
0⤋
assuming your array is an integer array
int *pointer;
int int my_array[] = {1,2,3,4,5,6};
pointer = &my_array[0];
Which means, make an integer pointer. Make an integer array. Point the pointer to the address of the first item in the array.
2007-07-09 07:39:12
·
answer #2
·
answered by electricalpanel 2
·
0⤊
0⤋
implementing distinctive information platforms (appropriate lists, wood, and so on, and so on) is a extensive work out IMO, and could help very lots with progression an awareness of memory administration and diverse time-venerated programming theories. additionally, some thing I did on an identical time as i grew to alter into into first getting to understand, grew to alter into into coding a clever bash like shell in C, as quickly as you're interested in working platforms programming, truly *nix platforms, I quite propose giving it a attempt, and programming a non-trivial, usable utility from scratch incredibly enables build self perception.
2016-10-20 10:46:47
·
answer #3
·
answered by ? 4
·
0⤊
0⤋
From the very little C knowledge I have, you point to the first item in the array.
2007-07-09 07:33:22
·
answer #4
·
answered by The Badp 2
·
0⤊
0⤋
myFunction(int someArray[]) {
int *arrayPtr = &someArray[0];
2007-07-09 07:34:55
·
answer #5
·
answered by McFate 7
·
0⤊
0⤋