Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

This is a vary simple program in c++ i shared below. i hope you can easily understand the concept of pointer that what is a pointer? what does pointer ? and how to use pointer ? See the example given below  for more detail please ask question in comments.

#include<iostream>// pre-processor directive iostream.h is a header file
using namespace std; // we are using standered keyword and expressions

cout"Facebook : hamidj3\n\n";
// what is point?
// pointer is a spacial kind of variable that is used to store the addresses of memory
int var=10;
// an integer type variable initialized
int *add;
// a pointer decleared
add= &var;
// &var will show the address of variable and now we are assigning the address to add pointer

cout"Memory address of var :"addendl;

// this is print the memory address of variable

cout"Value that is stored inside the memory address :"*addendl;
// this will printed the stored value inside the memory like var = 10 so 10 will be printed

system("pause");// this is a built-in function that is use to stop the console window for long

If the above code doesn't work then you may also download the attachment file given below 

Views: 350


Replies to This Discussion

what does int*add meanz????????

it means this is a pointer variable that will store the memory address 


explain plzzz

int * add is a pointer that will be used to store the memory address. memory address is a locations where we store values (information) like 

int x=10;

int is a data type mean to say we will store the integer into the x variable and 10 is a value that will be stored inside the x variable this x variable is a name of memory and it has an address we can print the memory address by putting an ampersand (&) before the x that will look like &x. so memory address can be fx00x11. now we need a spacial variable to store this fx00x11 where we can store this as this is a hexadecimal value. for this purpose we will declare a pointer variable. 

int staric variablename (int *add) here add= address and you may use any name instead of this add . you may use *y 

good work bro....



© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service