answersLogoWhite

0


Best Answer

A pointer is simply a variable that stores a memory address and that allows that memory to be dereferenced. Unlike a reference, which must always refer to the object assigned to it, a pointer can refer to any object of the pointer's type, including null. A null pointer is simply a pointer that does not refer to any object. In languages that do not support pass by reference (such as C), pointers must be used to pass objects to functions. The pointer is passed by value, but the value is a memory address, which is the same as passing the object at that address.

In languages that do support references (such as C++), references are useful when you need to guarantee an object exists because a reference can never be null. However, when passing an object to a function as an optional parameter, you must use a pointer because pointers can be null. Programmers must test pointers to ensure they are non-null before attempting to dereference them. References do not need to be tested; if a reference exists, it must refer to an object in memory.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the advantages of pointers in a program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


How pointers reduce the length of a program?

They don't.


Sample program for far pointers?

#include<stdio.h)


What are the advantages of using pointers in a program?

pointers points to the memory address of another variable.....in functions we have two kind of variables the actual and dummy variable. when we operate on variables..the value of dummy variables are effected, but if we want to make changes in the actual variable then we have to refer to their address..and we can reach to address of the variables by only using pointers.


Write a program to illustrate the usage of pointers with arrarys and functions?

* * * * * * * * * * write the c++ program and show me brifily?


Write a c program to copy two strings using pointers?

nahi malum


What will be the program to arrange numbers stored in array in ascending order using pointers?

sorry


How do you write c program to perform sum of elements of matrix using pointers with functions?

i cant write


How do you run graphics program in C?

pro c language to implement linear search using pointers


What are the advantages of Adobe Presenter Program?

Adobe Flash Program :D


What is difference between stack pointer and program counter?

Both of them are pointers, but otherwise they are completely unrelated. The former points to the current position of the stack, the latter points to the current instruction of the program.


What is advantages and disadvantages of client network?

This is ambiguous: A program can be anything from an operating system down to a calculator you need to specify the program and only then can you identify the advantages / disadvantages of it