C++ Questions Answers-C++ Pointer(PartII)


C++ Pointer(PartII)

1. Giving the following declarations, which of the following statements are not valid?
int i;
int *pi;
double d;
double *pd;
a. i=π     b.*pi=&i;      c. pd=π      d. pd=i;    e. pi=&i; Check answer 2. Given the following declarations, What is the value of each of the following expressions?
int i=10;
int *pi=&i;
double d=12.5;
double *pd=&d;
a. ++i;     b. ++(*pi);      c.--(*pd); Check answer 3. What is the error in each of the following expressions?
a. int *p=10;
b. int a=10;
    int **p=&a;
c. float x=5;
    int **p=x;
Check answer 4. The C++ program segments are not valid. Please explain the error in each program.
a. int *p;
    int **q;
    p=&q;
b. int **p;
    int **q;
    p=&q;
c. int **p;
    float *q;
    p=&q;
Check answer 5. What would be printed from the following C++ program segment?
int i=10;
int *p,**q,***r;
p=&i;
*p=15;
q=&p;
**q=20;
r=&q;
***r=++(*p);
cout<<i;Check answer


Comments

Jake comment

 Jake

1. a


2015-10-29



This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.