====== C Programming Language ====== * [[wp>C (programming language)]] :US: :GB: / [[wpde>C (Programmiersprache)]] :DE: === History === * [[http://www.jslint.com/chistory.html|The Development of the C Language]] ===== Documentation ===== * [[..:..:c:manuals_user_guides]] * [[..:..:c:reference]] * [[..:..:c:tutorials]] * [[..:..:c:coding_guidelines]] ===== Libraries ===== * [[http://www.cplusplus.com/reference/clibrary/|C Language Library Reference]] * [[http://code-reference.com/c|C Library]] -- Online reference for the [[wpde>Standard C Library]] * https://www.tutorialspoint.com/c_standard_library/index.htm * [[http://www.acm.uiuc.edu/webmonkeys/book/c_guide/|The C Library Reference Guide]] * [[wpde>GNU Scientific Library]] * [[https://www.tutorialspoint.com/c_standard_library/|C Standard Library Reference Tutorial]] * [[http://www2.hs-fulda.de/~klingebiel/c-stdlib/|Übersicht über die C Standard-Bibliothek]] -- (nach Kernighan/Ritchie: Programmieren in C, 2. Ausgabe, Anhang B) * [[https://www.gnu.org/software/libc/manual/html_node/Integers.html|Integers (The GNU C Library)]] [(https://web.archive.org/web/20240120083133/https://www.gnu.org/software/libc/manual/html_node/Integers.html)] ===== Examples & Solutions ===== ==== Effectively initializing arrays ==== * http://stackoverflow.com/questions/13477281/initializing-an-array-of-ints * http://stackoverflow.com/questions/201101/how-to-initialize-an-array-in-c ==== Type Cast ==== * http://www.convertdatatypes.com/Language-C.html [(https://web.archive.org/web/20190523124920/http://www.convertdatatypes.com/Language-C.html)] ==== Converting integers to strings and vice versa ==== * [[https://stackoverflow.com/questions/190229/where-is-the-itoa-function-in-linux|Where is the itoa function in Linux?]] * [[http://www.cesarkallas.net/arquivos/faculdade/estrutura_dados_1/complementos%20angela/string/conversao.html|Converting an int Into a String avoiding itoa (NOT ANSI C)]] ==== Arithmetic ==== * [[https://stackoverflow.com/questions/161797/is-ones-complement-a-real-world-issue-or-just-a-historical-one/186333#186333|Is one's complement a real-world issue, or just a historical one?]] * [[https://stackoverflow.com/questions/4536095/unary-minus-and-signed-to-unsigned-conversion|Unary minus and signed-to-unsigned conversion]] * [[https://stackoverflow.com/questions/1700713/in-c-how-to-get-calculate-the-negative-of-an-unsigned-quantity|In C, how to get calculate the negative of an unsigned quantity]] * [[wp>Two's complement]] * [[https://stackoverflow.com/questions/2539178/why-is-abs0x80000000-0x80000000|Why is abs(0x80000000) == 0x80000000?]] * [[https://stackoverflow.com/questions/8026694/c-unary-minus-operator-behavior-with-unsigned-operands|C: unary minus operator behavior with unsigned operands]] * [[https://stackoverflow.com/questions/1408361/unsigned-integer-to-bcd-conversion|Unsigned Integer to BCD conversion?]] [(https://web.archive.org/web/20200526131603/https://stackoverflow.com/questions/1408361/unsigned-integer-to-bcd-conversion)] === Counting Leading Zeros (CLZ) === * [[https://stackoverflow.com/questions/671815/what-is-the-fastest-most-efficient-way-to-find-the-highest-set-bit-msb-in-an-i|What is the fastest/most efficient way to find the highest set bit (msb) in an integer in C?]] * [[https://embeddedgurus.com/state-space/2014/09/fast-deterministic-and-portable-counting-leading-zeros/|Fast, Deterministic, and Portable Counting Leading Zeros]] ==== Bit Manipulation ==== * [[wp>Bit manipulation]] * [[http://bits.stephan-brumme.com/basics.html|Bit manipulation basics]] * [[http://bits.stephan-brumme.com/|The Bit Twiddler]] * [[https://graphics.stanford.edu/~seander/bithacks.html|Bit Twiddling Hacks]] * [[http://www.c-howto.de/tutorial/variablen/bitmanipulation/|Bitmanipulation]] ==== Design Patterns ==== * [[timer]] * [[..:..:finite_state_machines]] * [[http://aggregate.org/MAGIC/|The Aggregate Magic Algorithms]] ==== Pitfalls ==== * [[http://embeddedgurus.com/stack-overflow/2009/08/a-tutorial-on-signed-and-unsigned-integers/|A tutorial on signed and unsigned integers]] * [[http://embeddedgurus.com/stack-overflow/2009/05/signed-versus-unsigned-integers/|Signed versus unsigned integers]] * [[http://c-faq.com/expr/preservingrules.html|comp.lang.c FAQ list · Question 3.19 What's the difference between the “unsigned preserving” and “value preserving” rules?]] * [[http://stackoverflow.com/questions/2711522/what-happens-if-i-assign-a-negative-value-to-an-unsigned-variable|What happens if I assign a negative value to an unsigned variable?]] * [[http://www.rmbconsulting.us/a-c-test-the-0x10-best-questions-for-would-be-embedded-programmers|A “C” Test: The 0x10 Best Questions for Would-be Embedded Programmers]] -- A step-by-step guide through one of the most popular recruitment tools for embedded programmers. ===== Frequently Asked Questions ===== * [[https://stackoverflow.com/questions/8562694/how-to-declare-function-pointer-in-header-and-c-file|How to declare function pointer in header and c-file?]] * [[https://stackoverflow.com/questions/1433204/how-do-i-use-extern-to-share-variables-between-source-files|How do I use extern to share variables between source files?]] * [[https://stackoverflow.com/questions/3776098/cygwin-how-to-actually-use-gcc-mingw|Cygwin: How to actually use gcc-mingw]] * [[https://embeddedgurus.com/stack-overflow/2008/06/efficient-c-tips-1-choosing-the-correct-integer-size/|What is the correct integer size]] ==== Linting Issues ==== * [[https://www.approxion.com/?p=135|Using PC-Lint in a Linux Environment]] * [[https://stackoverflow.com/questions/22823277/how-do-i-suppress-pc-lint-errors-for-c99-style-initialization-of-structure-membe|How do I suppress PC-Lint errors for C99-style initialization of structure members?]] === Unary Minus === * [[https://stackoverflow.com/questions/8026694/c-unary-minus-operator-behavior-with-unsigned-operands|C: unary minus operator behavior with unsigned operands]] * [[https://stackoverflow.com/questions/1700713/in-c-how-to-get-calculate-the-negative-of-an-unsigned-quantity|In C, how to get calculate the negative of an unsigned quantity]] * [[https://stackoverflow.com/questions/9474699/unary-minus-for-0x80000000-signed-and-unsigned|unary minus for 0x80000000 (signed and unsigned)]] * [[https://internals.rust-lang.org/t/forbid-unsigned-integer/752|Forbid -(unsigned integer)]] * [[http://www.codingstandard.com/rule/5-3-1-do-not-apply-unary-minus-to-operands-of-unsigned-type/|Do not apply unary minus to operands of unsigned type]] === Signed and Unsigned Integers === * [[https://stackoverflow.com/questions/2711522/what-happens-if-i-assign-a-negative-value-to-an-unsigned-variable|What happens if I assign a negative value to an unsigned variable?]] * [[https://embeddedgurus.com/stack-overflow/2009/08/a-tutorial-on-signed-and-unsigned-integers/|A tutorial on signed and unsigned integers]] * [[https://stackoverflow.com/questions/8395418/when-will-an-unsigned-int-variable-becomes-negative|When will an unsigned int variable becomes negative]] ===== Test & Verification ===== * [[..:..:quality:static_code_analysis]] * [[..:..:unit_test]] ===== Development Tools ===== * [[..:..:beautifier]] * [[..:..:c:eclipse_ide]] * [[https://embeddedgurus.com/state-space/|Embedded Toolbox: Source Code Whitespace Cleanup]]