상세 컨텐츠

본문 제목

1일차 학습내용_c언어 printf함수

풀스텍과정

by 정태웅 2024. 5. 9. 13:41

본문

IDE(intergrated development)  : 통합개발환경

https://ellielee.tistory.com/477 : C언어 설치 및 Visual Studio Code 설치

공유폴더 : \\192.168.0.226

교재 tcpschools(https://www.tcpschool.com),

c언어코딩 도장(https://dojang.io/course/view.php?id=2), https://www.onlinegdb.com/

printf 함수는 화면(표준 출력)에 문자열을 출력하는 함수입니다.

printf("Hello, world!\n");    // Hello, world!
문자열 서식 지정자

printf로 문자열을 출력할 때는 서식 지정자로 %s를 사용합니다.

printf("%s\n", "Hello, world!");    // Hello, world!
%s를 두 번 사용했다면 각 %s에 들어갈 문자열을 , (콤마)로 구분하여 차례대로 넣어주면 됩니다.

printf("%s %s\n", "Hello", "1234");    // Hello 1234
서식 지정자의 내용과 출력할 문자열을 조합하여 최종 결과를 만들어냅니다. 특히 공백도 문자열의 한 부분이므로 출력 결과에 영향을 미칩니다.

printf("%s%s\n", "Hello", "1234");       // Hello1234
printf("%s, %s\n", "Hello,", "1234");    // Hello,, 1234
개행 문자(줄바꿈 문자)

\n을 사용하면 다음 줄로 넘어갑니다.
printf("Hello, world!\n");
printf("1234567890\n");
실행 결과
Hello, world!
1234567890

주석

주석은 소스 코드에 대한 설명을 작성하거나 코드를 임시로 컴파일 하지 않을 때 사용합니다.
// Hello, world! 출력 
printf("Hello, world!\n");
/* 컴파일에서 제외
printf("Hello, world!\n");
printf("1234567890");
*/
실행 결과
Hello, world!

 

GDB online Debugger | Compiler - Code, Compile, Run, Debug online C, C++

Online GDB is online compiler and debugger for C/C++. You can compile, run and debug code with gdb online. Using gcc/g++ as compiler and gdb as debugger. Currently C and C++ languages are supported.

www.onlinegdb.com

 

 





() : 가로
{} : 중가로
[] : 대가로

d:\web\mingw64\bin

gcc -v (c컴파일러 버젼확인)

cd \

path

sysdm.cpl

d:\web\C_WORK

https://www.tistory.com

변수를 선언하는 이유 : 변수는 코드의 재활용성과 가독성을 높여주고, 중복을 제거하여 유지보수가 용이하다.

https://www.w3schools.com/c/c_variables.php ==> c언어 온라인 강좌 참조

 

Tistory

좀 아는 블로거들의 유용한 이야기

www.tistory.com

abc.c
0.00MB
variable.c
0.00MB
variable1.c
0.00MB
variable2.c
0.00MB
variable3.c
0.00MB
variable4.c
0.00MB
코딩도장(책자).url
0.00MB
c언어 에뮬레이터.url
0.00MB
c언어_용어-노트.pdf
2.41MB

 

Tistory

좀 아는 블로거들의 유용한 이야기

www.tistory.com

 

 

관련글 더보기