Pointers, C/C++ Programming

In this sub-task will you implement three functions for the final three function prototypes that will do exactly the same as the three functions that you have just written. This time, however, you use pekararitmetik. The aim is for you to practice using the pointer, it is not allowed to use the index to perform operations on the array.

Arrays and pointers are very closely related, an array name can be seen as a constant pointer to first element in an array. Array name array thus corresponds to & array [0], ie the address on the first element in the array. Below is an example of how to print all the values in an array by using pekararitmetik.

void print_array (int * pointer, int size)
{
int * p;
for (p = pointer; pi <(pointer + size); p + +)
printf ("% d", * pi);
}

The pointer p is initialized to point to first element in an array. As long as the value of the pointer p is less than the array size increases the value of pi to point to the next element in the array. Print the value of pi points to using the *- operator.

Posted Date: 3/15/2013 5:48:47 AM | Location : United States







Related Discussions:- Pointers, Assignment Help, Ask Question on Pointers, Get Answer, Expert's Help, Pointers Discussions

Write discussion on Pointers
Your posts are moderated
Related Questions
decoding message

how to find the volume of cone , cylinder and sphere ?

Many modern cryptography algorithms require two numbers that are coprime, or sometimes referred to as relatively prime. Two numbers are coprime if their greatest common divisor is

how is it made

A: Use operator overloading to present a friend right-shift operator, operator>>. It is similar to the output operator, except the parameter doesn't contain a const: "Fred&" instea

in mobiles mumbers to alphabets

Reference Oddities A reference variable can demote to any integer variable, be it in an array or a member variable from structure or class. Reference variables can demote to co


Define the Category of Function? A function, depending on whether arguments or parameters are present or not and whether a value returned or not, may belong to one of the foll

This program requires the use of a windows box, no console applications are allowed. Prepare for Christmas now.  Each year, Reindeer Gift Emporium publishes a Christmas price list