Example of pointers, C/C++ Programming

#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, 
Posted Date: 4/1/2013 3:24:55 AM | Location : United States







Related Discussions:- Example of pointers, Assignment Help, Ask Question on Example of pointers, Get Answer, Expert's Help, Example of pointers Discussions

Write discussion on Example of pointers
Your posts are moderated
Related Questions
Define the Volatile Keyword Qualifiers in C Language? The volatile keyword proceed as a data type qualifier and a volatile variable is for dynamic use. E.G. for data that is to

C Program to copy the contents of a file: void main()    {   ifstream fin("input.txt");   ofstream fout("output.txt");   char ch;   while (fin)       {

HOW THE C PROGRAM CODING IMPLEMENTED DY ITSELF UNDERSTANDING . ALSO HOW I CAN A BECOME A GOOD PROGRAMMER IN C WHAT I DO FOR GOOD PROGRAMMING ,TELL ME HOW C CODING DEVELOP DY ITSELF


what is spanning tree? explain prims algorithm spanning tree?

New data members  New member functions  New constructors and destructor  New friends

Write a C program "team.c" that maintains information for a soccer team. The program will allow you to add and delete players from your team, to search your team for players by nam

Employ operator () instead of operator[]. While you have multiple subscripts, the cleanest way to do it is along with operator () instead of with operator[]. The reason is that

A: C++, unlike only about every other language with exceptions, is extremely accomodating while it comes to what you can throw. Actually, you can throw anything you akin to. That b

Project Description: Boots capture video from your YouTube channel and upload your own video to our channel or the copyright of the videos, bang, 3 parties, automatically delete