static_cast
C,C++,Python, MFC, Multi Threading, ORACLE, BIG DATA,HADOOP
This is a good video to refer to learn Difference Between Reference And Pointers In C++
Difference Between Reference And Pointers In C++
Pointer: A pointer is a variable that stores the memory address of another variable. It can be
nullptr, can be reassigned to point to different objects, and supports pointer arithmetic.Reference: A reference is an alias (another name) for an existing variable. It must be initialized when declared, cannot be
nullptrin normal C++, and cannot be reseated to refer to another object. It behaves like the original variable.
| Pointer | Reference |
|---|---|
| Stores an address | Alias of an existing object |
Can be nullptr | Cannot be nullptr (normal C++) |
| Can be reassigned | Cannot be reseated |
| Supports pointer arithmetic | No pointer arithmetic |
Requires * to access value | Used like a normal variable |
| Can point to dynamically allocated memory | Typically used for function parameters and return values |
int a = 10; int b = 20; int *p = &a; int &r = a; p = &b; // OK: pointer now points to b r = b; // Does NOT make r refer to b // It copies b's value into a
Result:
a = 20 b = 20 r refers to a
nullptr?Answer: Yes. A pointer can hold nullptr, indicating it does not point to any object.
nullptr?Answer: No. A reference must always refer to a valid object in normal C++.
Answer: Yes.
p = &b;
Answer: No. Once initialized, a reference always refers to the same object.
Answer:
new/delete)
nullptr)
Answer:
"A pointer is a variable that stores the address of another object. It can be null, reassigned, and supports pointer arithmetic. A reference is an alias for an existing object. It must be initialized, cannot be null in normal C++, and cannot be reseated. I use pointers when an object may be absent or for dynamic memory and polymorphism, while I use references for function parameters and return values when the object is guaranteed to exist."
⭐ Interview rating: If you can confidently give the 30-second answer and explain the r = b example correctly, you'd be answering this topic at the level expected of a senior C++ engineer.
Game Engines and Frameworks Using C++
Several game engines and frameworks utilize C++:Books can help in more ways than one. For example, they can take your vocabulary to the next level
Books can be our best friends, it's not for nothing that this saying is popular. Here are a few classics and what they can teach you when it comes to English language
Lord of the Flies
BY William Golding
Often prescribed as curriculum in school, this book is a modern novel using descriptive and dramatic language that helps a reader visualise the story
Animal Farm
BY George Orwell
Simple language drives this novel. This story is short and effective, giving the reader an understanding on how to use language in a clever way
To Sir, With Love
BY ER Braithwaite
The story is about how a professor wins over the hearts of unruly students. The words and characterisation will surely teach you a thing or two too
The Curious Incident of the Dog in the Night-Time
BY Mark Haddon
A heart-warming tale of an autistic kid and a dog who set out to solve a murder mystery. The perspective of the world that the kid, Christopher, has is charming
The Old Man and the Sea
BY Ernest Hemingway
Written by journalist Ernest Hemingway, the book has language that is clear, straight forward and factually tight. The sentence structure is short, making it easy to follow
If you want to send XML data to another service internally, you can use a variety of communication methods depending on your system architecture and the technologies you are working with. Here are some common approaches:
HTTP/HTTPS Requests:
requests library to send a POST request with an XML payload.pythonimport requests
url = "http://internal-service/api/endpoint"
headers = {"Content-Type": "application/xml"}
xml_data = """
<book>
<title>The Great Gatsby</title>
<author>F. Scott Fitzgerald</author>
<year>1925</year>
<genre>Fiction</genre>
</book>
"""
response = requests.post(url, data=xml_data, headers=headers)
print(response.status_code)
print(response.text)
Message Queues:
pika library to interact with RabbitMQ and send XML data as messages.pythonimport pika
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='book_queue')
xml_data = """
<book>
<title>The Great Gatsby</title>
<author>F. Scott Fitzgerald</author>
<year>1925</year>
<genre>Fiction</genre>
</book>
"""
channel.basic_publish(exchange='',
routing_key='book_queue',
body=xml_data)
connection.close()
Remote Procedure Call (RPC):
Inter-Process Communication (IPC):
For an ambitious project to make C++ easier to use and safer without damaging its efficiency or flexibility, see the Core C++ Guidelines.
1. What is an lvalue? An lvalue is an object that: Has an identifiable memory location. Has a name (in most cases). Can appear on th...