Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- int main() {
- string str = "Priscilla"; //
- rotate(str.begin(), str.begin() + 3, str.end());
- cout <<str;
- return 0;
- }
- /// Another one
- #include <iostream>
- using namespace std;
- int add(int , int );
- int main() {
- int(*funcPtr)(int, int);
- funcPtr = add;
- cout << "original function sum: " << add(5, 5) <<endl;
- cout << "pointer function sum: " << funcPtr(2,2);
- return 0;
- }
- int add(int a, int b){
- return a+b;
- }
- // Another one
- #include <iostream>
- using namespace std;
- int main() {
- // <type of pointer> *const <name of pointer
- int firstnumber = 1;
- int secondnumber = 2;
- int thirdnumber = 3;
- // a pointer const
- const int *ptr = &firstnumber;
- *ptr = 400; // here you cannot change the value the pointer refe
- ptr = &secondnumber;
- // a normal pointer
- int *temp = &secondnumber;
- *temp = 700; // here you can change the value the pointer refe
- // const pointer to a const
- const int* const tpr = &thirdnumber;
- *tpr = 400;
- *tpr = &firstnumber;
- /*
- auto_ptr
- unique_ptr
- shared_ptr
- weak_ptr
- */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement