Pointer

Lecture PPT

For Numerical Programming

For Embedded Controller

Summary

코딩도장 요약 : 포인터 사용하기 핵심요약

What are Pointers?

A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location.

(a) Define a pointer variable: int *ptr;

(b) Assign the address of a variable to a pointer: ptr = &var;

(c) Access the value at the address available in the pointer variable: int value = *ptr

For 32-Bit Word system (e.g. MCU)

32-CPU: 1 word = 4 bytes (32bit)

  • Memory: byte units

  • Int : 4 byte

  • Pointer variable: 4 byte (default)

TCP school.com

Example Code

Exercise

Exercise 1

다음 소스 코드를 완성하여 10과 20이 각 줄에 출력되게 만드세요.

실행 결과

Solution

Exercise 2

Exercise 3 - for EC only

Last updated

Was this helpful?