Pointers with an array, C/C++ Programming

// Basic pointer code

#include "stdafx.h"

#include iostream

using namespace std;

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

{

            int FirstNumber, SecondNumber;

            int * ptrNumber;

            ptrNumber = &FirstNumber;

            *ptrNumber = 10;

            ptrNumber = &SecondNumber;

            *ptrNumber = 20;

            cout << "FirstNumber is " << FirstNumber << endl;

            cout << "SecondNumber is " << SecondNumber << endl;

            return 0;

}

Output:

FirstNumber is 10
SecondNumber is 20
Posted Date: 4/1/2013 3:23:05 AM | Location : United States







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

Write discussion on Pointers with an array
Your posts are moderated
Related Questions
Develop a .NET wrapper for a C++ Dll Project Description: We have a classic VC++ Dll that requires a .NET wrapper built by you. Use latest Visual Studio and .Net framework sh

Explain the class invariant. - It's a condition that ensures correct working of a class and defines all the valid states for an object. - When an object is created class inv

Explain about the Integer constants in c language? An integer constant is the integer valued number and it refers to a sequence of digits. A decimal integer constant includes o


What I need is an auto-click bot. The auto-click bot would ask me for a url(or it would be pre-defined too) so that it loads that specific url and click an ad automatically. This w

Unlike C++, other programming languages have associative arrays that allow array indices to be strings instead of just integers. You are to create a template class, SVector, that i

Can a copy constructor admit an object of the similar class as parameter, rather than reference of the object?

overloadstream insertion opertator to display the data of object on the console

Add a function for saving the text stored in an array to a file. Your program must check whether or not the output file already exists, and if it does, your program must ask the us

There are 3 acceptable answers: "Never," "Rarely "and" When the problem domain cannot be accurately modelled any other way."