answersLogoWhite

0


Best Answer

No, but subtraction between pointers to the same type is possible.

User Avatar

Wiki User

โˆ™ 2010-10-02 15:55:53
This answer is:
User Avatar
Study guides

Algebra

20 cards

A polynomial of degree zero is a constant term

The grouping method of factoring can still be used when only some of the terms share a common factor A True B False

The sum or difference of p and q is the of the x-term in the trinomial

A number a power of a variable or a product of the two is a monomial while a polynomial is the of monomials

โžก๏ธ
See all cards
3.8
โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…
2250 Reviews

Add your answer:

Earn +20 pts
Q: Can you add two pointer variables?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can we directly multiply two pointer variables?

No. The only legal math you can do on two pointer variables is subtract them, but that only works if they point to elements of the same array.


How pointer differs from normal variable?

Pointer variables are perfectly normal variables.


What are the types of pointers in C plus plus?

Pointer variables and function pointers are the two primary types, as well as a void pointer (unknown type). Pointer variables can point to any valid type, including primitive types and user-defined types, as well as other pointer variables. Function pointers can point to any function with the same signature as the function pointer itself. Void pointers can point anywhere.


How many pointer to pointer is available in C programming?

A pointer is a variable. Like any other variable, it consumes memory (4 bytes on a 32-bit system). So you can have as many pointers as you like, with as many levels of indirection as you like, the only limit being dictated by available memory (which can never exceed 4GB on a 32-bit system). Pointer-to-pointer variables are no different to pointer variables (and therefore have the same limitation as pointer variables), except that a pointer variable points to a non-pointer variable (such as int) whereas a pointer-to-pointer variable points to a pointer variable of the same type (which, in turn, points to a non-pointer variable of the same type). In other words, pointer-to-pointer variables add an extra level of indirection. You can also indirect pointer-to-pointer variables via pointer-to-pointer-to-pointer variables, and so on. Pointer indirection is useful because, without them, pointers would always be passed to functions by value (never by reference). Passing by value copies the pointer variable, which means you can mutate the memory it points to, but you cannot change where it points (because that would only affect the copy, not the original pointer that was passed). To pass a pointer by reference you must pass the pointer indirectly, via a pointer-to-pointer, which is itself passed by value. This allows the function to mutate the pointer variable (changing where it points), as well mutating the memory it points to. Indirect pointers are also useful when allocating dynamic multi-dimensional arrays because each additional dimension requires an additional level of indirection.


How is pointer variable different from ordinary variable?

how pointers variables diffrent from ordinary variables

Related questions

Can we directly multiply two pointer variables?

No. The only legal math you can do on two pointer variables is subtract them, but that only works if they point to elements of the same array.


How accessing a pointer an a variable differs?

Pointer-variables are variables, so there is no difference.


How pointer differs from normal variable?

Pointer variables are perfectly normal variables.


What are the types of pointers in C plus plus?

Pointer variables and function pointers are the two primary types, as well as a void pointer (unknown type). Pointer variables can point to any valid type, including primitive types and user-defined types, as well as other pointer variables. Function pointers can point to any function with the same signature as the function pointer itself. Void pointers can point anywhere.


Explain reference variable and how it is different from pointer variable?

In JAVA, all variables are reference variables, and there are no pointer variables. Even though the platform may implement them as pointers, they are not available as such. In C, no variables are reference variables. They are a C++ enhancement. In C++ a reference variable is syntactically the same as a pointer variable, except that the use of the indirection operator (*) is implicit. You do declare reference variables slightly differently than pointer variables but, once you do so, they can be treated as non-pointer variables. Reference variables also cannot be redefined once they have been initialized to point to some object. They are const. Structurally, there is no difference between a pointer variable and a reference variable. They are both still pointers. The compiler just makes it easier to treat reference variables and non-pointer variables the same way.


What is pointer?

pointer r the variables created in RAM which store the address of a another variable


How many pointer to pointer is available in C programming?

A pointer is a variable. Like any other variable, it consumes memory (4 bytes on a 32-bit system). So you can have as many pointers as you like, with as many levels of indirection as you like, the only limit being dictated by available memory (which can never exceed 4GB on a 32-bit system). Pointer-to-pointer variables are no different to pointer variables (and therefore have the same limitation as pointer variables), except that a pointer variable points to a non-pointer variable (such as int) whereas a pointer-to-pointer variable points to a pointer variable of the same type (which, in turn, points to a non-pointer variable of the same type). In other words, pointer-to-pointer variables add an extra level of indirection. You can also indirect pointer-to-pointer variables via pointer-to-pointer-to-pointer variables, and so on. Pointer indirection is useful because, without them, pointers would always be passed to functions by value (never by reference). Passing by value copies the pointer variable, which means you can mutate the memory it points to, but you cannot change where it points (because that would only affect the copy, not the original pointer that was passed). To pass a pointer by reference you must pass the pointer indirectly, via a pointer-to-pointer, which is itself passed by value. This allows the function to mutate the pointer variable (changing where it points), as well mutating the memory it points to. Indirect pointers are also useful when allocating dynamic multi-dimensional arrays because each additional dimension requires an additional level of indirection.


How is pointer variable different from ordinary variable?

how pointers variables diffrent from ordinary variables


Can a pointer be considered a variable?

You can declare pointer-variables, if that's what you mean. Example: char *sample = "Sample";


How to write Program to swap two variables using function call by value?

The only way to achieve this is to pass pointer variables. A pointer is a variable that holds a memory address and allows indirect access to that memory. When you pass a pointer to a function, the pointer is passed by value. But since the value of a pointer is a memory address, it is the same as pass by reference: template<typename T> void swap (T* a, T* b) { T* temp = a; a = b; b = temp; }


How to Swap two variables without using third variable using pointer?

swap (int *a, int *b) { *a ^= *b; *b ^= *a; *a ^= *b; }


What is the significance of pointer variables in C programming?

Pointer variables point to data variables. They are mostly used to point to dynamically allocated data variables, but can actually point to anything (e.g. statically allocated variables, array elements, anywhere inside a variable, program machine code, I/O device descriptors, nonexistent memory). Misuse of pointer variables, either unintentionally or intentionally, is a major cause of nearly impossible to debug software problems in programs written in C (and C++).

People also asked