"함수 define()"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(다른 사용자 한 명의 중간 판 5개는 보이지 않습니다)
2번째 줄: 2번째 줄:
==C==
==C==
[[category: C]]
[[category: C]]
<source lang='C'>
<syntaxhighlight lang='C'>
#define PI 3.14159265358979323846
#define PI 3.14159265358979323846
</source>
</syntaxhighlight>
<source lang='C'>
<syntaxhighlight lang='C'>
#define GREET "Hello"
#define NAME "John"
...
...
printf("%s, World", GREET);
printf("Hello, %s!", NAME);
// Hello, World
// Hello, John!
</source>
</syntaxhighlight>


==Java==
==Java==
[[category: Java]]
[[category: Java]]
<source lang='java'>
<syntaxhighlight lang='java'>
public static final double PI = 3.141592653589793;
public static final double PI = 3.141592653589793;
</source>
</syntaxhighlight>


==PHP==
==PHP==
[[category:PHP]]
[[category:PHP]]
<source lang='php'>
<syntaxhighlight lang='php'>
define('GREETING', 'Hello world.');
define('PI', 3.14159265358979323846);
echo GREETING;
</syntaxhighlight>
// Hello world.
<syntaxhighlight lang='php'>
</source>
define('NAME', 'John');
echo 'Hello, ' . NAME . '!';
// Hello, John!
</syntaxhighlight>


==같이 보기==
==같이 보기==
*[[PHP 미리 정의된 상수]]
*[[PHP 미리 정의된 상수]]

2020년 11월 2일 (월) 02:36 기준 최신판

1 C[ | ]

#define PI 3.14159265358979323846
#define NAME "John"
...
printf("Hello, %s!", NAME);
// Hello, John!

2 Java[ | ]

public static final double PI = 3.141592653589793;

3 PHP[ | ]

define('PI', 3.14159265358979323846);
define('NAME', 'John');
echo 'Hello, ' . NAME . '!';
// Hello, John!

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}