2023 2024 Student Forum > Management Forum > Main Forum

 
  #2  
29th September 2014, 12:05 PM
Super Moderator
 
Join Date: Apr 2013
Re: Structure And Pointer in C What Is Difference

Structure in C refer to a collection of various data types for example you create a structure named "Student" which contains his name , roll no, DOB etc. Name is string, BOB is int.

While pointer refers to address in C & are used to point some particular place in C memory.

Pointers are constructs that point to the address location of a particular data type.
Pointers also need to have data types associated with them, i.e. while declaring we have to define the data type of the pointer, for e.g.
int * p;
char * p1;
but the pointer is just pointing to the memory location, which holds the particular variable.
So by just changing the reference of the pointer, the same pointer can point to any variable of that particular data type.

Pointer is dynamic in nature. The memory allocation can be resized or freed later.

Pointer can’t be initialized at definition

A pointer is a place in memory that keeps address of another place inside


Quick Reply
Your Username: Click here to log in

Message:
Options

Thread Tools Search this Thread



All times are GMT +5. The time now is 06:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
SEO by vBSEO 3.6.0 PL2

1 2 3 4