-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPointer.cpp
More file actions
31 lines (25 loc) · 724 Bytes
/
Pointer.cpp
File metadata and controls
31 lines (25 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "Learn_CPP.h"
std::unordered_map<std::string, Topic> getPointerTopics() {
std::unordered_map<std::string, Topic> topics;
topics["Pointers"] = {
"Pointers",
R"(Pointers are variables that store the memory address of another variable.
They are used for dynamic memory allocation, arrays, and function arguments.)",
R"(Syntax:
type* pointer_name;
Example:
int* ptr;)",
R"(Example Code:
#include <iostream>
using namespace std;
int main() {
int var = 10;
int* ptr = &var;
cout << "Value of var: " << var << endl;
cout << "Address of var: " << ptr << endl;
cout << "Value at the address: " << *ptr << endl;
return 0;
})"
};
return topics;
}