# C++ 초기설계자가 작성한 int* p 와 int *p 에 대한 글

> Clean Markdown view of GeekNews topic #7503. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=7503](https://news.hada.io/topic?id=7503)
- GeekNews Markdown: [https://news.hada.io/topic/7503.md](https://news.hada.io/topic/7503.md)
- Type: news
- Author: [0xwof](https://news.hada.io/@0xwof)
- Published: 2022-09-29T11:30:09+09:00
- Updated: 2022-09-29T11:30:09+09:00
- Original source: [stroustrup.com](https://www.stroustrup.com/bs_faq2.html#whitespace)
- Points: 10
- Comments: 3

## Topic Body

1. int *p 는 *p 의 타입이 int 라는 논리이다.  
2. int* p 는 p 의 타입이 pointer of int 라는 논리이다.  
3. 한 줄에 여러개의 변수를 선언할 때, int *p 가 더 오해의 여지가 적다.  
    - int *p0, p1; // p0 :: int*, p1 :: int  
    - int* p0, p1; // p0 :: int*, p1 :: int (int* 이라고 착각하기 쉬움)  
4. 한 줄에 여러개의 변수를 선언하지 않으면 이런 문제가 발생하지 않는다.  
5. C++ 초기설계자 자신은 둘다 맞다고 생각하지만, int* p 를 더 선호한다.

## Comments



### Comment 12557

- Author: penza1
- Created: 2022-09-29T15:47:08+09:00
- Points: 1

역시 코딩은 문학입니다

### Comment 12550

- Author: kayws426
- Created: 2022-09-29T13:22:59+09:00
- Points: 1

1. C 프로그래머: int *p 로 작성하며 *p 의 타입이 int 라고 설명 함  
2. C++프로그래머: int* p 로 작성하며 p 의 타입이 pointer of int 라고 설명 함  
  
"Whenever something is a matter of taste, discussions can drag on forever."

### Comment 12551

- Author: kayws426
- Created: 2022-09-29T13:31:59+09:00
- Points: 2
- Parent comment: 12550
- Depth: 1

TMI 지만,  
1. 이분의 이름으로 웹사이트가 있을줄 몰랐습니다.  
2. 이 사이트는 아파치 웹서버를 사용하며 C로 작성되었고 int *p 형태를 사용합니다.
