Git Product home page Git Product logo

c_knr's Introduction

Hi there πŸ‘‹ Hits

C C++ Go

git-stats

I love programming and problem-solving!

profile

c_knr's People

Contributors

ryanjeong avatar

c_knr's Issues

Indexing

각 μ˜ˆμ œμ—μ„œ μ‚¬μš©λœ ν•¨μˆ˜λ“€μ„ indexing

project

  1. char prog 이름을 λ§€ν¬λ‘œμ—μ„œ μ‚¬μš©ν•  수 μžˆλŠ”κ°€? μ‚¬μš©ν•  수 μžˆλ‹€λ©΄ static char progλ₯Ό util νŒŒμΌμ— μ •μ˜ν•΄ μ‚¬μš©ν•  것

math.h

The functions in stdlib.h and stdio.h have implementations in libc.so (or libc.a for static linking), which is linked into your executable by default (as if -lc were specified). GCC can be instructed to avoid this automatic link with the -nostdlib or -nodefaultlibs options.

The math functions in math.h have implementations in libm.so (or libm.a for static linking), and libm is not linked in by default. There are historical reasons for this libm/libc split, none of them very convincing.

Interestingly, the C++ runtime libstdc++ requires libm, so if you compile a C++ program with GCC (g++), you will automatically get libm linked in.

https://stackoverflow.com/questions/1033898/why-do-you-have-to-link-the-math-library-in-c

Test ν”„λ‘œκ·Έλž¨ μΆ”κ°€

각 μ˜ˆμ œμ— test codeλ₯Ό μΆ”κ°€ν•˜μ—¬ 각 μ˜ˆμ œλ“€μ΄ μ˜¬λ°”λ₯΄κ²Œ λ™μž‘ν•˜λŠ”μ§€ 확인할 것.

였λ₯˜ 발견

'\n' -> .. && c != '\n'; 이 λ‹¨κ³„μ—μ„œ 걸러짐

for (i = 0; i < (MAXLINE - 1) && (c = getchar()) != EOF && c != '\n'; ++i) {
line[i] = c;
}
/*
* MAXLINE : 4
* INPUT : H I \n \0
* ---------------------
* i = 0 -> store H, c = H
* i = 1 -> store I, c = I
* i = 2 -> store \n, c = \n
* i = 3 -> escape for statement{ i < (MAXLINE - 1) }, c = \n
* if (c == '\n') {
* line[i] = c;
* ++i;
* }
* i = 4 -> result: H I \n \n
* line[i] = '\0' // ERROR!!(out of range)
*/

TIL

TIL ν˜•νƒœλ‘œ 정리

Chapter 3-1 속도 차이

  • μ–΄μ…ˆλΈ”λ¦¬ λ‹¨μ—μ„œ μ½”λ“œ 뢄석

  • 속도 차이 λ°œμƒ 이유 μΆ”κ°€λ‘œ κ²Œμ‹œ

printf ν˜•μ‹λ¬Έμžμ—΄

int a = 10;
printf("%f", a); /* 0, not 10 */

castsκ°€ λ°œμƒν•˜λŠ” 것이 μ•„λ‹Œ, va_arg λ§€ν¬λ‘œμ—μ„œ λ©”λͺ¨λ¦¬μ— ν‘œν˜„λœ 값을 ν˜•μ‹ λ¬Έμžκ°€ κ°€λ¦¬ν‚€λŠ” ν˜•νƒœλ‘œ κ°€μ Έμ˜€κΈ° λ•Œλ¬Έμ—,
0x0000000A 값을 IEEE 754 ν‘œμ€€μ— 맞게 가져와 값이 0(맀우 μž‘μ€ κ°’)으둜 ν‘œν˜„λ¨μ„ μΆ”κ°€λ‘œ μ„€λͺ…ν•  것

2022

gcc -> Ctrl + Shift + B -> Makefile(μ½”λ“œ 뢄리 및 μ„œλ‘œ λ‹€λ₯Έ 디렉토리) -> 디버거 -> CMake

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.