âšī¸ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.1 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://www.designgurus.io/answers/detail/what-is-the-operator-in-cc |
| Last Crawled | 2026-04-11 00:57:07 (2 days ago) |
| First Indexed | 2024-11-21 15:13:16 (1 year ago) |
| HTTP Status Code | 200 |
| Meta Title | What is the '-->' operator in C/C++? |
| Meta Description | What is the '-->' operator in C/C++? |
| Meta Canonical | null |
| Boilerpipe Text | Example with Classes
In C++, the
->
operator is used similarly with classes:
#
include
<iostream>
#
include
<string>
class
Person
{
public
:
std
::
string name
;
int
age
;
Person
(
std
::
string n
,
int
a
)
:
name
(
n
)
,
age
(
a
)
{
}
}
;
int
main
(
)
{
Person
person
(
"John Doe"
,
30
)
;
Person
*
ptr
=
&
person
;
// Accessing members using the pointer and the -> operator
std
::
cout
<<
"Name: "
<<
ptr
->
name
<<
std
::
endl
;
std
::
cout
<<
"Age: "
<<
ptr
->
age
<<
std
::
endl
;
return
0
;
}
In this example:
ptr
is a pointer to a
Person
object.
ptr->name
accesses the
name
member of the object pointed to by
ptr
.
ptr->age
accesses the
age
member of the object pointed to by
ptr
.
Summary
The
->
operator in C and C++ is used to access members of a structure or class through a pointer. It combines the dereferencing of the pointer and accessing the member into one operation. This operator is essential when working with pointers to structures or classes, allowing for more concise and readable code.
For a deeper understanding of C++ pointers and more advanced topics, consider exploring courses like
Grokking the Coding Interview
on DesignGurus.io. This course covers essential coding and algorithm techniques that can help you master programming concepts and succeed in technical interviews. |
| Markdown | # What is the '--\>' operator in C/C++?
In C and C++, the `->` operator is used for accessing members of a structure or class through a pointer. It is not the same as the `.` operator, which is used to access members directly from an object. The `->` operator combines dereferencing a pointer and accessing a member in one step.
### Syntax and Usage
**Syntax:**
```
pointer->member
```
**Usage:**
- `pointer` is a pointer to a structure or class.
- `member` is a member of the structure or class.
When you have a pointer to a structure or a class, you use the `->` operator to access its members instead of using the dereference operator `*` followed by the dot operator `.`.
### Example with Structures
Consider the following structure in C:
```
#include <stdio.h>
struct Person {
char name[50];
int age;
};
int main() {
struct Person person = {"John Doe", 30};
struct Person *ptr = &person;
// Accessing members using the pointer and the -> operator
printf("Name: %s\n", ptr->name);
printf("Age: %d\n", ptr->age);
return 0;
}
```
In this example:
- `ptr` is a pointer to a `Person` structure.
- `ptr->name` accesses the `name` member of the structure pointed to by `ptr`.
- `ptr->age` accesses the `age` member of the structure pointed to by `ptr`.
### Example with Classes
In C++, the `->` operator is used similarly with classes:
```
#include <iostream>
#include <string>
class Person {
public:
std::string name;
int age;
Person(std::string n, int a) : name(n), age(a) {}
};
int main() {
Person person("John Doe", 30);
Person *ptr = &person;
// Accessing members using the pointer and the -> operator
std::cout << "Name: " << ptr->name << std::endl;
std::cout << "Age: " << ptr->age << std::endl;
return 0;
}
```
In this example:
- `ptr` is a pointer to a `Person` object.
- `ptr->name` accesses the `name` member of the object pointed to by `ptr`.
- `ptr->age` accesses the `age` member of the object pointed to by `ptr`.
### Summary
The `->` operator in C and C++ is used to access members of a structure or class through a pointer. It combines the dereferencing of the pointer and accessing the member into one operation. This operator is essential when working with pointers to structures or classes, allowing for more concise and readable code.
For a deeper understanding of C++ pointers and more advanced topics, consider exploring courses like **[Grokking the Coding Interview](https://www.designgurus.io/course/grokking-the-coding-interview)** on DesignGurus.io. This course covers essential coding and algorithm techniques that can help you master programming concepts and succeed in technical interviews.
TAGS
Coding Interview
CONTRIBUTOR
Design Gurus Team
\-
GET YOUR FREE
Coding Questions Catalog

Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now\!
Explore Answers
[Can I self study coding?](https://www.designgurus.io/answers/detail/can-i-self-study-coding)
[Is Coinbase work from home?](https://www.designgurus.io/answers/detail/is-coinbase-work-from-home)
[What is a redux in React?](https://www.designgurus.io/answers/detail/what-is-a-redux-in-react)
[Does Anthropic pay well?](https://www.designgurus.io/answers/detail/does-anthropic-pay-well)
[What are the do's and don'ts of a mock interview?](https://www.designgurus.io/answers/detail/what-are-the-dos-and-donts-of-a-mock-interview)
[What technology does Stripe use?](https://www.designgurus.io/answers/detail/what-technology-does-stripe-use)
Related Courses
[ Grokking the Coding Interview: Patterns for Coding QuestionsGrokking the Coding Interview Patterns in Java, Python, JS, C++, C\#, and Go. The most comprehensive course with 476 Lessons.4.6Discounted price for **Your Region** \$197 Preview](https://www.designgurus.io/course/grokking-the-coding-interview)
[ Grokking Modern AI FundamentalsMaster the fundamentals of AI today to lead the tech revolution of tomorrow.3.9Discounted price for **Your Region** \$72 Preview](https://www.designgurus.io/course/grokking-modern-ai-fundamentals)
[ Grokking Data Structures & Algorithms for Coding InterviewsUnlock Coding Interview Success: Dive Deep into Data Structures and Algorithms.4Discounted price for **Your Region** \$78 Preview](https://www.designgurus.io/course/grokking-data-structures-for-coding-interviews)

One-Stop Portal For Tech Interviews.
About Us
[Our Team](https://www.designgurus.io/team)
[Careers](https://www.designgurus.io/career)
Contact Us
Become Affiliate
[Become Contributor](https://www.designgurus.io/become-contributor)
Social
[Facebook](https://www.facebook.com/sysdesigngurus)
[Linkedin](https://www.linkedin.com/company/designgurus/)
[Twitter](https://twitter.com/sysdesigngurus)
[Youtube](https://www.youtube.com/channel/UCupx1O-omoKq73JS3p6jlvQ)
[ Substack New](https://designgurus.substack.com/)
LEGAL
[Privacy Policy](https://www.designgurus.io/privacy)
[Cookie Policy](https://www.designgurus.io/cookie-policy)
[Terms of Service](https://www.designgurus.io/terms)
RESOURCES
[Blog](https://www.designgurus.io/blog)
[Knowledge Base](https://www.designgurus.io/kb)
[Blind 75](https://www.designgurus.io/blind75)
[Company Guides](https://www.designgurus.io/company-guides)
[Answers Hub](https://www.designgurus.io/answers)
[Newsletter](https://www.designgurus.io/newsletter)
Copyright Š 2026 Design Gurus, LLC. All rights reserved. |
| Readable Markdown | ### Example with Classes
In C++, the `->` operator is used similarly with classes:
```
```
In this example:
- `ptr` is a pointer to a `Person` object.
- `ptr->name` accesses the `name` member of the object pointed to by `ptr`.
- `ptr->age` accesses the `age` member of the object pointed to by `ptr`.
### Summary
The `->` operator in C and C++ is used to access members of a structure or class through a pointer. It combines the dereferencing of the pointer and accessing the member into one operation. This operator is essential when working with pointers to structures or classes, allowing for more concise and readable code.
For a deeper understanding of C++ pointers and more advanced topics, consider exploring courses like **[Grokking the Coding Interview](https://www.designgurus.io/course/grokking-the-coding-interview)** on DesignGurus.io. This course covers essential coding and algorithm techniques that can help you master programming concepts and succeed in technical interviews. |
| Shard | 194 (laksa) |
| Root Hash | 12470636387615709394 |
| Unparsed URL | io,designgurus!www,/answers/detail/what-is-the-operator-in-cc s443 |