DIR Return Create A Forum - Home
---------------------------------------------------------
Class Discussion
HTML https://srm.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Data Structure
*****************************************************
#Post#: 5--------------------------------------------------
struct and malloc() - Data Structure
DIR By: prannyll
Date: April 12, 2019, 11:54 pm
---------------------------------------------------------
struct - It is a composite data type declaration that defines a
physically grouped list of variables to be placed under one name
in a block of memory, allowing the different variables to be
accessed via a single pointer.
Syntax : struct name(optional) { struct-declaration-list };
Example : struct s { int n; double d; };
malloc() - or “memory allocation” method is used to dynamically
allocate a single large block of memory with the specified size.
Syntax : ptr = (cast-type*) malloc(byte-size);
Ex : (struct node*) malloc(sizeof(struct node*));
*****************************************************
Page 1 of 1