• 카테고리

    질문 & 답변
  • 세부 분야

    기타 (개발 · 프로그래밍)

  • 해결 여부

    해결됨

1:45 쯤에 Declare와 Define 질문있습니다.

24.02.27 04:54 작성 24.02.27 04:57 수정 조회수 100

0

int a = 0; // Define a variable with initial value 0

int b; // Declare a variable

 

이렇게 되는게 맞나요?

 

음성과 화면에서 메모리 할당이라는 표현을 하셨는데

 

좀더 확실히 이해하고 넘어가기 위한 질문입니다.

 

변수 선언시 초기값 여부에따라 메모리 할당 O X를 말씀하신거죠?

답변 2

·

답변을 작성해보세요.

0

https://stackoverflow.com/questions/20822022/whats-the-difference-between-variable-definition-and-declaration-in-javascript

위 스택오버플로우 질문 답변 및

 

아래 geeksforgeeks 콘텐츠가 도움되실 것 같습니다.

Declaration of a variable is for informing the compiler of the following information: name of the variable and the type of the value it will hold i.e., declaration gives details about the properties of a variable. Whereas, in the Definition of a variable, memory is allocated for the variable.

변수 선언은 변수의 이름과 변수가 보유할 값의 유형을 컴파일러에 알리기 위한 것입니다. 즉 선언은 변수의 속성에 대한 세부 정보를 제공합니다. 반면, 변수 정의에서는 변수에 메모리가 할당됩니다.

출처: https://www.geeksforgeeks.org/difference-between-definition-and-declaration/


프로그래밍 하면서도 정의와 선언을 완벽하게 구분하지 않아도 커뮤니케이션에 큰 무리는 없지만, 정확하게 커뮤니케이션하려면

int a = 0; // Define a variable with initial value 0

int b; // Declare a variable

이 맞습니다.

0

Define나 Declare를 명확하게 구분하지 않고 그냥

 

Declare a variable with initial value. 혹은 Define a variable without initial value. 처럼 쓰면 완전히 틀린표현일까요?