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
What is default constructor? explain it.

We started off taking about input, output, CPU and memory devices. Within C we need a method of storing large amounts of data in memory. We have used the idea of variables (pointer

The goto statement This statement can be used to branch to another statement of the program. This is rarely used as it violates the principle of structured programming. Though

Problem : Change to palindrome A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your ta

Public, Private and Protected members: Class members can either be declared in public','protected' or in the 'private' sections of the class. But as one of the features of OOP i

THIS PROGRAM IS TO ADD TWO DISTANCES & SHOW THEIR SUM AS NEW DISTANCE # include # include typedef int dist; struct distance   {   dist inch;   dist feet;   }; distance add

Need Payment Gateway Integration Expert Project Description: I am seeking for expert payment gateway integration. You must have done or have experience with integrating me

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

What is the difference between structure and class? - Members of structures are public while those of a class are private. - Classes provide data hiding while structures don