Example of pointers, C/C++ Programming

Assignment Help:

#include "stdafx.h"

#include iostream

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

            int NumbHold[5];

            int * ptrNumb;

            ptrNumb= NumbHold; 

            *ptrNumb= 10;

            ptrNumb++; 

            *ptrNumb= 20;

            ptrNumb= &NumbHold[2]; 

            *ptrNumb= 30;

            ptrNumb= NumbHold + 3; 

            *ptrNumb= 40;

            ptrNumb= NumbHold; 

            *(ptrNumb+4) = 50;

            for (int n=0; n<5; n++)

                        cout << NumbHold[n] << ", ";

            cout << endl;

            return 0;

}

Output:

10, 20, 30, 40, 50, 

Related Discussions:- Example of pointers

#coding, Smugglers are becoming very smart day by day. Now they have develo...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Define local classes, A cl a s s c a n b e d e f i n e ...

A cl a s s c a n b e d e f i n e d i n s i d e a b l o c k o r f u n c t i o n.   T h i s t yp e cla s s i s known

Illustrate the example of constructor, A Constructive Example Consider ...

A Constructive Example Consider an example , to model a user-defined data type for  strings. The object simulates a character array ( string ) using a character pointer and an

Describe difference between malloc()/free() & new/delete?, for object, mall...

for object, malloc allocates memory in heap however doesn't invoke object's constructor to initialize the object. new allocates memory & also invokes constructor to initialize the

Socket Programming, Need someone to look over my assignment for correctness...

Need someone to look over my assignment for correctness and make any necessary changes.

Area Under Curve, Write a program to find the area under the curve y = f(x)...

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

C program to check even & odd no, C Program to Check  EVEN & ODD NO   ...

C Program to Check  EVEN & ODD NO   main() {           int n, a;           clrscr();           printf("ENTER ANY NUMBER: ");           scanf("%d", &n);

Structured design of programs, Within software engineering, software is ver...

Within software engineering, software is very rarely written by a single software engineer. Usually a team of engineers write a program; therefore a formal structural design approa

Calculate the area of circle using c program, Calculate the area of circle ...

Calculate the area of circle using c program: const float Pi = 3.1415926;   inline float area(const float r) {return Pi * r * r;}   main() {    float radius;

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd