Questions about member pointers in the structure

Asked 2 years ago, Updated 2 years ago, 47 views

Hello.

I have a question about the structure.

As I study, there are cases where pointer variables are declared and used in the structure, such as "char *name",

What are the benefits of using it like this?

For example, I think you can declare it as "char name" and use it...

struct st {
 int id;
 char *name;
};

pointer

2022-09-22 17:56

1 Answers

Char is just a data declaration that contains one character.

Perhaps the meaning of the *name of that structure means to contain a string. Because of that, it can't be included in the "char name", right?

Description of characters and strings is

https://dojang.io/mod/page/view.php?id=328

Replace with the link above.


2022-09-22 17:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.