Answer Posted / inderchauhan
A pointer is a special kind of variable in C and C++ that
holds the address of another variable.
my first pointer
#include <iostream>
using namespace std;
int main ()
{
int firstvalue, secondvalue;
int * mypointer;
mypointer = &firstvalue;
*mypointer = 10;
mypointer = &secondvalue;
*mypointer = 20;
cout << "firstvalue is " << firstvalue << endl;
cout << "secondvalue is " << secondvalue << endl;
return 0;
}
firstvalue is 10
secondvalue is 20
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is new line escape sequence?
What is wrong with this code?
Are the outer parentheses in return statements really optional?
What are the functions to open and close the file in c language?
What is a macro?
program for reversing a selected line word by word when multiple lines are given without using strrev
Explain how do you view the path?
What is the modulus operator?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is type qualifiers?
Do array subscripts always start with zero?
Write a program to generate random numbers in c?
please send me the code for multiplying sparse matrix using c
Explain how do you print only part of a string?
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);