C-Programmming | The Compiler | Identifiers | Literals | linkage | C Operators | C Syntax Structures | GBD Debugger | Operating Systems | devdocs.io

C Programming

cprog The C programming language is at the heart of GNU/Linux - it is the programming language most of the Linux Kernel and GNU tools is written in.

There are many outstanding books and online resources where you can learn C and as such this site will not try and duplicate these efforts.

What I will try to do here is try to complement other sources, trying to explain parts which are easily overlooked by beginners or are difficult to remember. I hope that you like what is on offer and if you do, please bookmark these pages and spread the word.

  1. The C Language
  2. Standard Library
    • The Standard Headers
      • stdarg.h - variadic functions
      • Macros:
        va_start             enables access to variadic function arguments (function macro)
        va_arg               accesses the next variadic function argument(function macro)
        va_copy              (C99) makes a copy of the variadic function arguments (function macro)
        va_end               ends traversal of the variadic function arguments (function macro)
        
        Type:
        va_list              holds the information needed by va_start, va_arg, va_end, and va_copy (typedef)
        
        #include <stdio.h>
        #include <stdarg.h>
        
        void simple_printf(const char* fmt, ...)
        {
            va_list args;
            va_start(args, fmt);
        
            while (*fmt != '0') {
                if (*fmt == 'd') {
                    int i = va_arg(args, int);
                    printf("%dn", i);
                } else if (*fmt == 'c') {
                    // A 'char' variable will be promoted to 'int'
                    // A character literal in C is already 'int' by itself
                    int c = va_arg(args, int);
                    printf("%cn", c);
                } else if (*fmt == 'f') {
                    double d = va_arg(args, double);
                    printf("%fn", d);
                }
                ++fmt;
            }
        
            va_end(args);
            }
           
      • Functions at a Glance
  3. Basic Tools
    • Compiling with GCC
    • Using make to Build C Programs
    • Debugging C Programs with GDB
    • Using an IDE with C
    • Unicode in C
  4. Problem Solving
  5. Videos

    Books

    Other External Links

http:///wiki/?cprogramming

19may23   admin