Exercises : Answer the following Question

Submitted by tushar pramanick on Fri, 03/08/2013 - 00:42

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson. The answers and hints to the questions and exercises are given in Appendix E, "Answers to Quiz Questions and Exercises."

    How can you obtain the left value of a character variable ch?
    In the following expressions, does the asterisk (*) act as a dereference operator or as a multiplication operator?
        *ptr
        x * y
        y *= x + 5
        *y *= *x + 5
    Given that x = 10, the address of x is 0x1A38, and ptr_int = &x, what will ptr_int and *ptr_int return, respectively?
    Given that x = 123, and ptr_int = &x after the execution of *ptr_int = 456, what does x contain?

Exercises

    Given three integer variables, x = 512, y = 1024, and z = 2048, write a program to print out their left values as well as their right values.
    Write a program to update the value of the double variable flt_num from 123.45 to 543.21 by using a double pointer.
    Given a character variable ch and ch = `A', write a program to update the value of ch to decimal 66 by using a pointer.
    Given that x=5 and y=6, write a program to calculate the multiplication of the two integers and print out the result, which is saved in x, all in the way of indirection (that is, using pointers).

Related Items

Declaring Pointers

Declaring Pointers

What Is a Pointer?

What Is a Pointer?

A pointer is a variable whose value is used to point to another variable.

Exercises : Answer the following Question

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.

Question and Answer

Question and Answer

    Q How many expressions are there in the if statement?

The goto Statement

The goto Statement