User Tools

Site Tools


c_language:overview

This is an old revision of the document!


Things i should read up on

Underhanded C Contest

The International Obfuscated C Code Contest

Right-to-left rule

SO thread

Reddit

To decode the expression char (*(*x())[5])()

         x          : x is a
         x()        : function
        *x()        : returning pointer to
       (*x())[5]    : a 5-element array of 
      *(*x())[5]    : pointer to
     (*(*x())[5])() : function
char (*(*x())[5])() : returning char

Const

uint8_t const *foo; // Points at constant. Can't change the value that foo points at.
const uint8_t *foo; // Same as above.
uint8_t *const foo; // Constant pointer. Can't change the address it is holding.

stdint.h, printf and scanf

stdint.h has definitions of uint8_t etc.

inttypes.h has definitions of PRIu8 etc, for use with printf and scanf.

This site lists all available macros and types.

#include <stdint.h>
#include <inttypes.h>
 
...
 
  printf("Printing a uint8_t: %" PRIu8 " woop woop!", var8bit);

Snippets

Debug macro

#define STRINGIFY_(X) #X
#define STRINGIFY(X) STRINGIFY_(X)
#define PING() debug_print_str(__FILE__ " : " STRINGIFY(__LINE__) "\n")
c_language/overview.1621935402.txt.gz · Last modified: 2022/09/12 00:30 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki