Bifalgorithm post

To be effective in C++, you need to understand a pointer to a pointer. Here's a scenario where a pointer to a pointer might show up organically, and that is for command line arguments. The parameters are defined as int argc, the argument count, and then a pointer to a character pointer. This is another way of saying an array of strings. A C-style string is represented as an array, and if you pass that to a function, the array decays to a pointer. a them to the console. Another example is if we want a function to change where a pointer points. This scenario we're creating an int pointer data with the value 5 and here's code in a function to replace that with a new area in memory with the value 10. In order for this to work we must pass a pointer to data and you can see that this changes where the pointer actually points in memory.

To be effective in C++, you need to understand a pointer to a pointer. Here's a scenario where a pointer to a pointer might show up organically, and that is fo…

Ideas in this flowchart

  • Understanding Pointers to Pointers in C++
  • Command Line Arguments
  • Parameters Definition
  • int argc
  • Pointer to Character Pointer
  • Array of Strings
  • C-Style String
  • Array Decays to Pointer
  • Function Pointer Reassignment
  • Changing Pointer Target
  • int Pointer Data = 5
  • Function Code Example
  • New Memory Area with Value 10
  • Passing Pointer to Data
  • Pointer Changes in Memory
Feed/

To be effective in C++, you need to understand a pointer to a pointer. Here's a scenario where a pointer to a pointer might show up organically, and that is for command line arguments. The parameters are defined as int argc, the argument count, and then a pointer to a character pointer. This is another way of saying an array of strings. A C-style string is represented as an array, and if you pass that to a function, the array decays to a pointer. a them to the console. Another example is if we want a function to change where a pointer points. This scenario we're creating an int pointer data with the value 5 and here's code in a function to replace that with a new area in memory with the value 10. In order for this to work we must pass a pointer to data and you can see that this changes where the pointer actually points in memory.

"To be effective in C++, you need to understand a pointer to a pointer."

👍
0
0 comments0 shares

Sign in to view and post comments.