answersLogoWhite

0


Best Answer

Yes, it is quite common.

Example:

struct List {

struct List *Next;

int value;

}

typedef struct List List;

Example2:

typedef struct Tree Tree;

struct Tree {

Tree *left,*right;

int value;

};

User Avatar

Wiki User

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

Wiki User

17y ago

yes, a structure contain a pointer to itself... struct name { int. .... struct name * ptr; }; thats y its called self referential's strutures....

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

yes

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can a Structure contain a Pointer to itself?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between structure and pointer?

A structure is a collection of primitives or other structures. A pointer is a memory address. Comparison of the two is like comparing bowling balls to cinder blocks. You can say that a structure defines the layout of the data, while a pointer points to data that is a particular structure.


Can stack be as a pointer?

A stack is a data structure in which last item inserted is taken out first . That's why they are known as LIFO (last in first out). Inserting an item in stack is termed as push and taking an item out from stack I s termed as pop. Stack pointer is the pointer that points to the top of the stack or that points the item at the top of the stack and help in adding or deleting the item from the top of stack.


In the 8051 what value does the stack pointer contain immediately after reset?

07H


What is difference between pointer and structures?

pointer data type that carry address:of data type that has no name but both of them must have same data type. structures you can make your own data type: struct name put any data type you wants any functions.


Meaning c plus plus pointer to an array and pointer to a structure?

They both mean the same thing; an array is a type of data structure (a linear structure). A pointer variable is just a variable like any other, but one that is used to specifically store a memory address. That memory address may contain a primitive data type, an array or other data structure, an object or a function. The type of the pointer determines how the data being pointed at is to be treated. Pointers must always be initialised before they are accessed, and those that are not specifically pointing at any reference should always be zeroed or nullified with the NULL value. This ensures that any non-NULL pointer is pointing at something valid. Remember that pointer variables are no different to any other variable insofar as they occupy memory of their own, and can therefore point to other pointer variables.

Related questions

Can structure contain a pointer itself?

Yes a simple exp is the link list. struct node { int data; struct node *link; }


What is the difference between structure and pointer?

A structure is a collection of primitives or other structures. A pointer is a memory address. Comparison of the two is like comparing bowling balls to cinder blocks. You can say that a structure defines the layout of the data, while a pointer points to data that is a particular structure.


What is pointer to a member in objective c?

It is a pointer that points to a member of a structure.


What happens if we use an integer pointer as a member of structure instead of structure pointer?

By declaring an integer pointer you are declaring that any non-zero reference stored in the pointer is guaranteed to be an integer reference. In order to guarantee the reference is actually a structure, the pointer must be declared as such, because casting an integer to a structure can never be regarded as being type-safe.


Can pointer point itself?

No


How can one create a pointer to structure in C?

Create a pointer of the type (pointer to struct) and assign the address of an instance of the structure to your pointer: typedef struct x { /* ... */ }; struct x my_structure; struct x* ptr = &my_structure;


What is pointer why you use pointer?

Pointer is a variable that stores the address of another variable. Since pointer is also akind of variable, thus pointer itself will be stored at a different memory location.


Why pointer is not an object?

A pointer in itself is not an object, because it is not an instance of a class. Of course you can define a class which has only one member, which is a pointer. class Pointer { public void *ptr; }; Pointer p, q, r;


What is pointer to a structure?

A pointer is a variable that holds address information. For example, in C++, say you have a Car class and another class that can access Car. Then, declaring Car *car1 =new Car() creates a pointer to a Car object.. The variable "car1" holds an address location.


32 can you create a linked list with out structure pointer?

Not in C, no.


How can you use pointer is data structure?

Your question makes no sense.


How is a structure type pointer variable declared?

struct thisorthat *ptr;