강의

멘토링

커뮤니티

Inflearn Community Q&A

rancho9746937's profile image
rancho9746937

asked

Hong Jung-mo's Follow Along and Learn C Programming

12.1 Overview of Memory Layout

10:13 호출되는 함수 변수의 메모리할당 시점 질문입니다

Resolved

Written on

·

370

0

10:13  호출되는 함수 변수의 메모리할당 시점 질문입니다

 

void func()

{

  int l_arr[MAX] = { 0, };

}

  int l_arr[MAX] 가 컴파일 할때 할당되는건가요?
문득 전에 

main 이외에 함수들을 정의는 안한채로 선언만할수 있고
그렇게하면 컴파일러에서는 에러는 안내지만 

링킹할때 문제 생긴다고 하셨던게 떠 올라서

이미 정의까지 되어있는 함수에 대해서는 메모리에 할당되는 시점이 컴파일 할때라고 이해하면 괜찮을까요?

 

메모리할당c

Answer 2

1

안녕하세요~

1. 네 컴파일 때 할당됩니다

2. 정의된 함수들은 코드가 저장되는 영역에 저장되기 때문에 런타임에 저장되지 않는 것은 확실한 것 같아요!

Where are functions stored in memory C?

The simple answer is for the ‘code’ portion in a hunk of memory, with the rest of the machine instructions, which is traditionally called the ‘text’ or ‘code’ section

0

rancho9746937님의 프로필 이미지
rancho9746937
Questioner

답변고맙습니다 ㅎ

rancho9746937's profile image
rancho9746937

asked

Ask a question