Exforsys
+ Reply to Thread
Results 1 to 3 of 3

Operations with Pointers

This is a discussion on Operations with Pointers within the C and C++ forums, part of the Programming Talk category; I want to know whether all arithmetic operations are allowed with pointer variables. If not what are the operations that ...

  1. #1
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128

    Operations with Pointers

    I want to know whether all arithmetic operations are allowed with pointer variables. If not what are the operations that are allowed and not allowed. Kindly provide the list.


  2. #2
    rachelle is offline Member Array
    Join Date
    Apr 2006
    Answers
    97
    The allowed operations on Pointers are:
    Assignment to other pointers of the same type
    Addition and subtraction of a pointer to an integer
    Assignment of the value 0
    Comparison to the value 0

    Other than the above operations other operations are not allowed with pointers.


  3. #3
    caradoc is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    122
    To explain you in brief I have given below some examples on operations that are not allowed with pointers.
    Multiplication or division on a pointer
    Addition or subtraction of two pointer values
    Assignment of a value other than 0 to a pointer


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...