From the course: C Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Pointers and references

Pointers and references - C Tutorial

From the course: C Essential Training

Pointers and references

- [Instructor] Pointers are very powerful, very common, and can be dangerous if abused. It's important to understand how pointers work and to really understand pointers, we need to first understand how a variable works. A variable is a typed and named location and memory. This is a variable definition. Here, memory is allocated for a value of type integer and is associated with the name x. Here, the integer value 1 is copied into the memory location associated with the integer variable x. Now we define another variable. The variable y represents another integer in a different memory location than variable x. This is an assignment. Here, the value from the variable named x is copied to the variable named y, the variable y now contains a separate integer, in a separate memory location, with the same value as the variable x. We see that the name of a variable is used as an index to map to a memory address and a specific…

Contents