answersLogoWhite

0


Best Answer

The main advantages of using pointers are

1.) Function cannot return more than one value. But when the same function can modify many pointer variables and function as if it is returning more than one variable.

2.) In the case of arrays, we can decide the size of the array at runtime by allocating the necessary space.

C has a minimum number of fundamental data types - a single character, a single integer or float, and a few derived data types such as a structure, an enumerated list, and an array. If you want to do much more than that, you make use of pointers.

Pointers allow you to dynamically request memory to store off information for use later. They allow you to create linked lists and other algorithmically oriented data structures.

User Avatar

Wiki User

16y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

8y ago

We use pointers to refer to objects in memory. Unlike a named object which can only refer to itself, a pointer can refer to any object in memory.

A pointer is a variable. Just as an integer variable is used to store an integer value, a pointer is used to store a memory address. The primary operator of a pointer is the dereference operator (prefix *). This operator gives us indirect access to the value stored at that memory address.

Since pointers exist in memory, they have an address (an identity), thus pointers can be used to refer to other pointers. This adds an extra level of indirection.

In C, all arguments are passed to functions by value, but when the formal argument of a function is a pointer we can pass the address of an object by value instead. This is effectively the same as passing by reference. If we wish to pass a pointer by reference, we simply add an extra level of indirection to the formal argument. In so doing, we can pass the address of the pointer itself rather than the address of the object it refers to.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

1) Pointers provide us a means through which we can directly access the memory location of a variable. 2) Pointer's support dynamic allocation routines. 3) Pointers can improve the efficiency of certain routines.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

Pointers are used to store memory addresses and to allow indirect access to the values stored at those memory addresses. C uses pass by value semantics by default, but by passing pointers you gain pass by reference semantics. The pointer itself is passed by value and is therefore copied, but the copy refers to the same address as the original pointer.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

As the name suggests Pointer is used to point towards something ,here in this case it points to another variable and stored at a memory location. Pointer is a variable that stores address of another variable. Different Types of pointers are: 1)Dangling Pointers 2)NULL Pointers 3)This Pointer 4)Generic Pointer 5)Near Pointer 6)Far Pointer

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is pointer and pointer types and uses of pointer and the meaning of pointer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Different types of pointers in c language?

... are usable. void pointer (generic pointer) : a special type of pointer which point to some data of no specific types. void *p; null pointer : a special type of pointer which point nowhere. it is usually used to check if a pointer is pointing to a null or free the pointer during deallocation of memory in dynamic memory allocation; it is define by using the predefine constant NULL int *p=NULL; wild pointer : uninitialized pointer. it hold a garbage value. i.e it is not pointing to any memory location yet. dangling pointer: pointer pointing to a destroyed variable. it usually happen during dynamic memory allocation when the object is destroyed but not free and the pointer is still pointing to the destroy object.


How many type of pointer in c?

A pointer is a pointer to something else. One way to look at it is that there is only one pointer type - an address to something else. Another way to look at it is to see how many different types there are, such as int, char, float, struct, double, etc. and to realize that you can build a pointer to any of them, as well as a pointer to a pointer to any of them, etc., etc., etc. Bottom line, is there are an unlimited number of types of pointers.


What are the three uses of void data types?

The void type has only one purpose: to specify the return type of a function that has no return value. In this case void simply means no type. The only other usage is when used as a pointer to void (void*), which simply means a pointer type that can refer to any type of object. If the pointer is non-null, it must be cast to a specific type before it can be dereferenced.


Which programming language uses a mouse pointer shaped in the form of turtle?

Logo


Why far pointer is not there in Linux?

Pointer types are very specific to the compiler used and oftentimes subject to the target architecture. The concept of a near/far differentiation may not have any meaning on the memory model of your target. This has nothing to do with Linux or whatever OS you choose to use. More information should be provided with the documentation of your compiler.

Related questions

What is exposure draft the types uses and correct application?

the meaning of exposure draft, types, uses and application


What is void pointer and what are its uses?

Void pointer can hold the address of any kind of pointer. But we can't operate on void pointer


Why would you use a pointer to pointer a in aprogram?

A pointer to pointer has many uses, one of the simplest being 2D arrays (matrices). Compacting garbage collectors also often employ pointer pointers.


Different types of pointers in c language?

... are usable. void pointer (generic pointer) : a special type of pointer which point to some data of no specific types. void *p; null pointer : a special type of pointer which point nowhere. it is usually used to check if a pointer is pointing to a null or free the pointer during deallocation of memory in dynamic memory allocation; it is define by using the predefine constant NULL int *p=NULL; wild pointer : uninitialized pointer. it hold a garbage value. i.e it is not pointing to any memory location yet. dangling pointer: pointer pointing to a destroyed variable. it usually happen during dynamic memory allocation when the object is destroyed but not free and the pointer is still pointing to the destroy object.


Three types of scoring in basket ball game?

Free throw, 2 pointer, 3 pointer.


What tool uses a magnetized pointer to show direction?

compass


How many type of pointer in c?

A pointer is a pointer to something else. One way to look at it is that there is only one pointer type - an address to something else. Another way to look at it is to see how many different types there are, such as int, char, float, struct, double, etc. and to realize that you can build a pointer to any of them, as well as a pointer to a pointer to any of them, etc., etc., etc. Bottom line, is there are an unlimited number of types of pointers.


What is a connotative meaning for mouse?

Vulnerable Apex :)


What is the silver pointer in a synagogue?

The pointer a person uses in a synagogue is called a Yad. They use it to read from the Torah. It is also used during Bar Mitzvahs.


What are the three uses of void data types?

The void type has only one purpose: to specify the return type of a function that has no return value. In this case void simply means no type. The only other usage is when used as a pointer to void (void*), which simply means a pointer type that can refer to any type of object. If the pointer is non-null, it must be cast to a specific type before it can be dereferenced.


What is void pointer variable?

A void pointer variable is a pointer variable (of some type) that is assigned the value zero, meaning it points to address zero. Memory address zero is a reserved address, which means the pointer variable references nothing in particular.


How many types of pointers are there?

That depends on what you consider a type. A pointer variable simply stores a memory address or NULL so, strictly speaking, there is only one type of pointer. A pointer variable's type (int *, char *, void *, etc) determines the type that a pointer points to, not the type of the pointer itself. Whether a pointer points to a primitive type, a user-defined type, a function, another pointer or void, makes no difference to the pointer variable itself. It simply stores a memory address. How you treat that memory address is determined by the pointer variable's type. So, in that respect, there are as many types of pointer as there are types to point at; which would be infinite. The architecture determines the size of a pointer variable. On a 16-bit system, a pointer will occupy just 2 bytes, while on a 32-bit system it occupies 4 bytes and 8 bytes on a 64-bit system. Although these may be considered separate pointer types, you can't pick and choose which type you use. The size must be consistent for any given architecture, hence the prevalent use of the sizeof() operator to determine a variable's length at runtime.