main.cpp
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* main.cpp :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: gychoi <gychoi@student.42seoul.kr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2023/07/25 18:52:52 by gychoi #+# #+# */ 9 /* Updated: 2023/07/25 20:31:38 by gychoi ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include <iostream> 14 #include <string> 15 16 int main(void) 17 { 18 const std::string str("HI THIS IS BRAIN"); 19 const std::string* stringPTR = &str; 20 const std::string& stringREF = str; 21 22 std::cout << "The memory address of the string variable: " << &str << std::endl; 23 std::cout << "The memory address held by stringPTR: " << stringPTR << std::endl; 24 std::cout << "The memory address held by stringREF: " << &stringREF << '\n' << std::endl; 25 26 std::cout << "The value of the string variable: " << str << std::endl; 27 std::cout << "The value pointed to by stringPTR: " << *stringPTR << std::endl; 28 std::cout << "The value pointed to by stringREF: " << stringREF << std::endl; 29 return (0); 30 }