Thursday, 8 April 2021

Pointer in C and C++ Qus 7

 #include<stdio.h>

#include<iostream.h>

#include<conio.h>

int main()

{

clrscr();

int a=5;

int *p;

p=&a;

cout<<a<<endl;

cout<<++a<<endl;

cout<<p<<endl;

cout<<++p<<endl;

int b=7;

const int *q;

q=&b;

//cout<<q<<endl;

cout<<b<<endl;

cout<<++b<<endl;

int const  *r ;

r=&b;

//cout<<r;

//cout<<q<<endl;

//cout<<++q<<endl;


const int c=5;

const int * const m=&c;

//m=&c;

//*m=10;

const int * n;

n=&c;

++n;

int d=5;

int * const o=&d;

//o++;

d++;

//*o++;

++(*o);

//o=&c;

int const *s=&d;

s++;

d++;

*s++ ;

*s=10;

getch();

return 0;

}

No comments:

Post a Comment