1

What I've seen so far in examples are things like the below with no space between * and x.

    int num = 10;
    int *x = #

However, there's this struct definition in code I am working with where the pointer is not directly next to p.

    struct passwd * p = getpwuid(getuid());

Do the spaces on both sides make an important difference or is this just a syntactical alternative?

Is this specific to structs?

I learned the terms for pointers association to a variable with no luck on what the instance I've provided could mean.

Ranoiaetep
  • 5,872
  • 1
  • 14
  • 39
  • 2
    It's a matter of style, there's no effect on behavior. Generally, spaces and line-breaks can be safely removed, (except for the last space between two letters, removing which would turn them into a single word). – HolyBlackCat Nov 22 '22 at 22:17
  • Thank you! I figured it'd likely be a syntax issue given that it performs as expected otherwise. Glad to have the confirmation. – concreteCozy Nov 22 '22 at 22:19
  • 1
    Related, here's a marvelous tool for helping decode difficult declarations: https://cdecl.org/ – Andy Lester Nov 22 '22 at 22:27

0 Answers0