Professional Documents
Culture Documents
Data Structures
Data Structures
Ans: After a call to free(p) makes a subsequent reference to *p illegal, i.e. though the storage to p is freed but the value of p(address) remain unchanged .so the object at that address may be used as the value of *p (i.e. there is no way to detect the illegality).Here p is called dangling pointer. To avoid this it is better to set p to NULL after executing free(p).The null pointer value doesnt reference a storage location it is a pointer that doesnt point to anything. ---------------------------------------------------
In case of C Functions. Declaration: When we write the prototype of the function before using it, this is called function declaration. Definition: When we define code for the function with the function name itself, it is called function definition.
DECLARATION : declaration only creates the variable name and nothing exists against it. i.e no memory space is consumed. eg. extern a; DEFINITION : definition declares as well as assigns some value to the variable. eg. int a; even though we are not mentioning any value default value is provided by the C compiler. eg. int a=10;
Data structure means how the data is organized in memory.There are diferent kind of data structures. Some are used to store the data of same type and some are used to store different types of data. Linear datastructures are accessed non-sequentially... Example:- arr[8],arr[4]Non-Linear data stuctures are accessed sequentially..