Logo
Search
Search
View menu

Pointers and Extension of C

Presentations | English

A pointer is a variable that stores the address of another variable. Unlike other variables that hold values of a certain type, pointer holds the address of a variable. C allows you to have pointer on a pointer and so on. Passing an argument by reference or by address enable the passed argument to be changed in the calling function by the called function. C allows a function to return a pointer to the local variable, static variable, and dynamically allocated memory as well. In C, dynamic memory is allocated from the heap using some standard library functions. The two key dynamic memory functions are malloc() and free(). The malloc() function takes a single parameter, which is the size of the requested memory area in bytes. It returns a pointer to the allocated memory. Pointers are used for file handling. Pointers are used to allocate memory dynamically. In C++, a pointer declared to a base class could access the object of a derived class. However, a pointer to a derived class cannot access the object of a base class.

Picture of the product
Lumens

27.25

Lumens

PPTX (109 Slides)

Pointers and Extension of C

Presentations | English