What is Pointer Arithmetic

Pointer Arithmetic: C and C++ provide the ability to modify a pointer’s target address with arithmetic operations. This is used, for example, to index arrays.

MyObject* P = ...

...

P = P + 42;

For model checkers such as Java whose modeling notations do not support these operations directly, these operations can be problematic to model. For example a pointer variable can be mapped directly to a Java reference unless any pointer operations are performed on it anywhere in the code (e.g., pointer addition or taking its address). They require creation of explicit “C-pointer” objects with additional state (base, offset). We also need to create a model of the memory and the platform in order to be able to effectively model such arithmetic operations. While this can be supported in practice, it can significantly increase the complexity of the model and hence the size of the state space.

   Related Questions in Programming Languages

  • Q : What is Break statement Break statement

    Break statement: A statement employed to break out of a loop, switch statement or labeled block. In all situations, control continues with the statement instantly, subsequent to the containing block.

  • Q : How would you extract an exact

    How would you extract an exact attribute by using XSLT, from an element into an XML document?

  • Q : Aggregation and containment in the

    Illustrate the basic difference between Aggregation and containment in the Programming?

  • Q : Java program to sort ten numbers using

    Q. Write a java program to sort ten numbers using bubble sort method. Ans. class Bubble sort

    Q : Main uses of Virtual memory Illustrate

    Illustrate the main uses of Virtual memory?

  • Q : Inheritance in Object Oriented

    Q. What is the use of making a method private inside

  • Q : Write a recursive implementation of

    Assignment 5 Selecting Array Elements Implement the following C++ code in assembly language, using the block-structured .IF and .WHILE directives. Assume that all variables are 32-bit signed integers: int array[] = {10,60,20,33,72,89,45,65,72,18}; int sample = 50; intArraySize = s

  • Q : What is a Pipe Pipe : It is a linkage

    Pipe: It is a linkage between the two program components. One component responds as a source of data, and writes into the pipe. The second components act as a receiver (that is, sink) for the data and reads from pipe.

  • Q : Define Single line comment Single line

    Single line comment: A comment is in the form:     // this line will be avoided by the compiler.

  • Q : Reading Algorithms Assignment 1:

    Assignment 1: Algorithms Rules: See the Assignment Rules file on the class Moodle site. 1 Reading Algorithms (20 points) Input: A nonempty string of characters S1S2 . . . Sn, and a positive integer n giving the number of characters in the string. Output: See t

©TutorsGlobe All rights reserved 2022-2023.