๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

โœ’๏ธ C Programming/Practice & Tips12

[C ์–ธ์–ด] ์ผ์ฐจ์› ๋ฐฐ์—ด๊ณผ ๋‹ค์ฐจ์› ๋ฐฐ์—ด # ์ผ์ฐจ์› ๋ฐฐ์—ด & ๋‹ค์ฐจ์› ๋ฐฐ์—ด 2022. 6. 16.
[C ์–ธ์–ด] for ๋ฌธ๊ณผ while ๋ฌธ & break ์™€ continue # for ๋ฌธ๊ณผ while ๋ฌธ, continue, break 2022. 6. 14.
[C ์–ธ์–ด] ์—ฐ์‚ฐ์ž์™€ ํ˜•์‹ ์ง€์ •์ž & ์ž๋ฃŒํ˜• & ์‚ผ๊ฐํ˜• ์ •์˜ ํ”„๋กœ๊ทธ๋žจ ์ œ์ž‘ # ๋‹ค์–‘ํ•œ ์—ฐ์‚ฐ์ž & ์‚ผ๊ฐํ˜• ์ •์˜ ํ”„๋กœ๊ทธ๋ž˜๋ฐ & ํ˜•์‹ ์ง€์ •์ž & ์ž๋ฃŒํ˜• 2022. 6. 13.
[C ์–ธ์–ด] ์ž๋ฃŒํ˜•๊ณผ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ & ์›ํ™” ๋ฐ ๋‹ฌ๋Ÿฌ ๊ณ„์‚ฐ ํ”„๋กœ๊ทธ๋žจ # ์›ํ™” & ๋‹ฌ๋Ÿฌ ๊ณ„์‚ฐ ํ”„๋กœ๊ทธ๋žจ + ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ + ์ž๋ฃŒํ˜• 2022. 6. 10.
[C ์–ธ์–ด] ์ฃผ์„ ์ฒ˜๋ฆฌ์™€ ์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค & ๋ณ€ํ™˜ ๋ฌธ์ž & ๋ณ€์ˆ˜์™€ ๋ณ€์ˆ˜๋ช… ์ž‘์„ฑ ์‹œ ์ฃผ์˜์‚ฌํ•ญ 1. ์˜ค๋Š˜์˜ ์ฒซ ์ฃผ์ œ๋Š” '์ฃผ์„'! ํ˜•ํƒœ 1 = // -> ์ฃผ๋กœ ํ•œ์ค„ ์ฃผ์„์—์„œ ์‚ฌ์šฉํ•˜๋Š” ํ˜•์‹์ž„ ํ˜•ํƒœ 2 = /**/ -> ์—ฌ๋Ÿฌ ์ค„ ์ฃผ์„์—์„œ ์‚ฌ์šฉ 2. ๋‘ ๋ฒˆ์งธ ์ฃผ์ œ '์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค'! *์ค„๋ฐ”๊ฟˆ = \n (\ : ๋ฌธ์„œ์—๋Š” ์—ญ์Šฌ๋ž˜์‹œ๋กœ ๋‚˜์™€ ์žˆ์–ด์„œ ๋”ฐ๋กœ ํƒ€์ž๋ฅผ ๊ธฐ์–ตํ•ด ๋†“์•„์•ผ ํ•จ) *๊ฒฝ๊ณ  = \a *๋ฐฑ์ŠคํŽ˜์ด์Šค = \b *ํƒญ = \t *๋ฐฑ์Šฌ๋ž˜์‹œ = \\ *์ž‘์€๋”ฐ์˜ดํ‘œ = \' *ํฐ๋”ฐ์˜ดํ‘œ = \" 3. ๋˜ ๋‚˜์˜จ ๋ณ€ํ™˜ ๋ฌธ์ž! %d -> ์ •์ˆ˜ %f -> ์‹ค์ˆ˜, ๋ถ€๋™์†Œ์ˆ˜์ ์ˆ˜ ( 9.0๊ฐ™์€ ๊ฑด ์ •์ˆ˜ ์•„๋‹ˆ๊ณ  ๋ถ€๋™์†Œ์ˆ˜์ ์ˆ˜๋กœ ๋ณธ๋‹ค. ) %c -> ๋ฌธ์ž %s -> ๋ฌธ์ž์—ด %f -> ์†Œ์ˆ˜์  ์•„๋ž˜ ์—ฌ์„ฏ์ž๋ฆฌ๊นŒ์ง€ ์ถœ๋ ฅ(๊ธฐ๋ณธ) ex. 3.462222 %.3f -> ์†Œ์ˆ˜์  ์•„๋ž˜ ์„ธ์ž๋ฆฌ๊นŒ์ง€ ์ถœ๋ ฅ ex. 7.777 %.1f -> ์†Œ์ˆ˜์  ์•„๋ž˜ .. 2022. 4. 12.
[C ์–ธ์–ด] ์ฝ”๋“œ ๊ตฌ์กฐ์™€ ๋ฌธ์ž, ๋ฌธ์ž์—ด ์ถœ๋ ฅ & ์ž๋ฃŒํ˜• ์ถœ๋ ฅ #include main() { ์ฝ”๋“œ ์ƒ์„ธ return 0; } # ๋ฌธ์ž๋Š” ๋ฐ˜๋“œ์‹œ ์ž‘์€๋”ฐ์˜ดํ‘œ๋กœ(''), ๋ฌธ์ž์—ด์€ ๋ฐ˜๋“œ์‹œ ํฐ๋”ฐ์˜ดํ‘œ๋กœ("")๋กœ ๋‘˜๋Ÿฌ์‹ธ์ฃผ์ž ex) R ์‹ค์ˆ˜๋กœ ์ถœ๋ ฅ, printf("%f", 3.14); %c -> ๋ฌธ์ž๋กœ ์ถœ๋ ฅ, printf("%c", 'p'); %s -> ๋ฌธ์ž์—ด๋กœ ์ถœ๋ ฅ, printf("%s", "๊ณผ์ œ"); 2022. 4. 3.