Files
cpp01/ex02/main.cpp
2025-09-29 07:13:10 +02:00

42 lines
1.5 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/06 01:58:01 by aortigos #+# #+# */
/* Updated: 2025/09/29 07:12:22 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include <iostream>
int main()
{
std::string str = "HI THIS IS BRAIN";
std::string *ptr = &str;
std::string &ref = str;
// Imprimimos las direcciones de memoria
std::cout << "Printing memory addresses..." << std::endl;
std::cout << "Str memory address: " << &str << std::endl;
std::cout << "Ptr memory address: " << ptr << std::endl;
std::cout << "Ref memory address: " << &ref << std::endl;
std::cout << std::endl;
// Imprimimos los valores
std::cout << "Printing values..." << std::endl;
std::cout << "Str value: " << str << std::endl;
std::cout << "Ptr value: " << *ptr << std::endl;
std::cout << "Ref value: " << ref << std::endl;
return (0);
}