#include <iostream>
using namespace std;
const char* getName() {
return "Jack Jack";
}
int main() {
const char* name = "Jack Jack";
const char* name2 = "Jack Jack";
cout << (uintptr_t)name << endl; //140698765208664
cout << (uintptr_t)name2 << endl; //140698765208664
cout << (uintptr_t)getName() << endl; //140698765208664
cout << name << endl; //문자열 출력은 null만날 때까지 출력!
}
name과 name2는 같은 주소를 갖게 된다.
'코딩 > C++' 카테고리의 다른 글
const 포인터 (0) | 2024.03.09 |
---|---|
동적할당(new, delete) (0) | 2024.03.08 |
포인터 (0) | 2024.03.07 |
구조체 (0) | 2024.03.06 |
자료형 별칭(typedef, using) (0) | 2024.03.05 |