CPP01
Main topics
Memory allocation, pointers to members, references, switch statementMemory allocation
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int *ptr; // declare the pointer
ptr = malloc(sizeof(int)); // allocate the memory
*ptr = 45; // assign a value
printf("ptr value: %d\n", *ptr); // print the value
free(ptr); // deallocate the memory
return (0);
}Pointers to members
.* operator
- >* operator
Call member function from pointer to member function
References
Things to note about references in C++
Switch statement
Last updated