---
title: "Discussion on \"The hidden detail behind std::addressof in C++\" | Hashnode"
description: "Discussion on \"The hidden detail behind std::addressof in C++\". In c++, even something like &obj is not always what it seems.\nNormally, when we write:\nstruct Resource {\n    int data = 42;\n};\n\nint main() {\n    Resource r;\n    auto h = &r;\n    std::cout << h << '\\n'"
url: "https://hashnode.com/posts/the-hidden-detail-behind-std-addressof-in-c/69f05a6d6ad9c5aa3b72c77a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [The hidden detail behind std::addressof in C++](https://sigsegv.hashnode.dev/the-hidden-detail-behind-std-addressof-in-c?utm_source=hashnode&utm_medium=feed)

In c++, even something like &obj is not always what it seems. Normally, when we write: struct Resource { int data = 42; }; int main() { Resource r; auto h = &r; std::cout << h << '\\n'

Apr 28 · 3 min read · sigsegv.hashnode.dev  
Read the article

-   [#cpp](https://hashnode.com/tag/cpp)
-   [#low-level-programming](https://hashnode.com/tag/low-level-programming)
-   [#internals](https://hashnode.com/tag/internals)
-   [#stl](https://hashnode.com/tag/stl)

## Written by

[ashwith chandra](https://hashnode.com/@ashu2427)

@ashu2427 · Hyderabad, India

  
[View profile](https://hashnode.com/@ashu2427)

I build things to understand them

I write about C++, performance, and building things from first principles. Currently exploring data structures, allocators, and how things work under the hood.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
