Hi guys,

Is there a difference between these two:

struct->variable
struct.variable

?

Yes, the first is a pointer while the other is not. Example

struct something
{
  int variable;
  // blabla
};

struct somtehing* ptr; // ptr->variable
struct something obj; // obj.variable

Yes, the first is a pointer while the other is not. Example

struct something
{
  int variable;
  // blabla
};

struct somtehing* ptr; // ptr->variable
struct something obj; // obj.variable

Thank You very much for the fast answer!

a->variable = the variable field of the struct a points to

a.variable = the variable field of the struct a

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.