Skip to content
0
  • Home
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
  • Home
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Sketchy)
  • No Skin
Collapse

Wandering Adventure Party

  1. Home
  2. Uncategorized
  3. i'm gonna be honest.

i'm gonna be honest.

Scheduled Pinned Locked Moved Uncategorized
3 Posts 3 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Eniko FoxE This user is from outside of this forum
    Eniko FoxE This user is from outside of this forum
    Eniko Fox
    wrote last edited by
    #1

    i'm gonna be honest. while i understand the difference in C between

    const char* ptr

    and

    char *const ptr

    i will never be able to remember the 2nd form exists let alone use it

    K~K 1 Reply Last reply
    0
    • Eniko FoxE Eniko Fox

      i'm gonna be honest. while i understand the difference in C between

      const char* ptr

      and

      char *const ptr

      i will never be able to remember the 2nd form exists let alone use it

      K~K This user is from outside of this forum
      K~K This user is from outside of this forum
      K~
      wrote last edited by
      #2

      @eniko I struggled to remember exactly how each of these worked until someone told me that I should read it from right to left.

      i.e.
      `const char*` is a pointer to a char constant. So the thing being pointed to is const.
      And `char * const` is a constant pointer to a char. So the pointer itself is const.

      NullN 1 Reply Last reply
      0
      • K~K K~

        @eniko I struggled to remember exactly how each of these worked until someone told me that I should read it from right to left.

        i.e.
        `const char*` is a pointer to a char constant. So the thing being pointed to is const.
        And `char * const` is a constant pointer to a char. So the pointer itself is const.

        NullN This user is from outside of this forum
        NullN This user is from outside of this forum
        Null
        wrote last edited by
        #3

        @karadoc@aus.social @eniko@mastodon.gamedev.place A good way to read C type declarations is the "Spiral Rule". see: https://ongspxm.gitlab.io/reading/2021/01/the-spiral-rule-in-c/

        1 Reply Last reply
        0

        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Login or register to search.
        Powered by NodeBB Contributors
        • First post
          Last post