Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
포인터의기초 (2) - 포인터 사용하기1
Next
Download to read offline and view in fullscreen.

4

Share

Download to read offline

4. 함수포인터

Download to read offline

함수 포인터의 사용법

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

4. 함수포인터

  1. 1. C언어와포인터(4) 함수포인터 "완전학습을지향하는"NHN NEXT 정호영 나눔고딕및나눔고딕코딩글꼴을설치해주세요.
  2. 2. 오늘의토픽 -간단하게함수포인터에대해배워보자.
  3. 3. 함수의구성요소 1.입력-parameter 2.함수이름-foo 3.출력-return intfoo(intn, double x) { … return 1; }
  4. 4. 함수를구별할수있게하는요소들 1.parameter의개수,각각의타입 2.함수이름foo=함수의코드(인스트럭션)가저장된주소 3.return타입 intfoo(char, double)
  5. 5. 함수이름 1.함수의코드(인스트럭션)가저장된주소 2.아마도코드영역(읽기전용)일것이다. 3.생각해보니포인터랑비슷한것같다. intfoo(char, double)
  6. 6. 함수이름=주소인지확인해보자. https://gist.github.com/honux77/c44182cdf8e777dc2d38
  7. 7. 결과 == Result (VS2013, win7) == address of foo = 002A10F0address of main = 002A1140address of literal = 002A5878address of global = 002A801Cpointer value in stack = 0046F90Caddress of x = 0046F928pointer value in heap = 0083E2B0계속하려면아무키나누르십시오. . .
  8. 8. 함수이름=주소=포인터 그럼포인터변수에함수이름을넣을수도있겠네요. 네~됩니다.
  9. 9. 포인터변수에함수이름을넣으려면 함수를구별할수있는형식이어야할것같습니다.
  10. 10. 함수를포인터로대입하려면필요한것들 1.parameter의개수,타입 2.함수코드가들어있는곳주소(=이름) 3.리턴타입
  11. 11. 함수의포인터 1.parameter-double,int 2.함수의주소-(*ptr)에저장 3.리턴타입-int return_type(*function)(arg1, arg2, ...); int(*ptr)(double, int)
  12. 12. https://gist.github.com/honux77/ef2476764669218e5af4
  13. 13. 함수포인터의용도 여러가지가있는데각자공부합시다. 한가지만알아봅니다.
  14. 14. qsort함수사용예제 함수포인터가들어있습니다. 저타입에맞는함수를만들어봅시다.
  15. 15. https://gist.github.com/honux77/25c55f2264b29568aac7
  16. 16. 주의!헷갈리지말아야할것들 ?! int(*ptr)(int); int*ptr[4]; int(*ptr)[4];
  17. 17. 주의!헷갈리지말아야할것들 ?! //int를parameter로받고int를리턴하는함수포인터 int(*ptr)(int); //int포인터가4개있는int포인터배열 int*ptr[4]; // 4개짜리1차원int배열의포인터 //2차원배열에대응 int(*ptr)[4];
  18. 18. Thank You
  • EugeneLee16

    Mar. 29, 2015
  • rullrow1

    Feb. 8, 2015
  • zungmini

    Jan. 22, 2015
  • chjin

    Oct. 24, 2014

함수 포인터의 사용법

Views

Total views

1,488

On Slideshare

0

From embeds

0

Number of embeds

215

Actions

Downloads

21

Shares

0

Comments

0

Likes

4

×