The Programming Language C

Operators in C

Operators in C and C++: http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B

C supports a rich set of operators, which are symbols used within an expression to specify the manipulations to be performed while evaluating that expression. C has operators for:

  • arithmetic (+, -, *, /, %)
  • equality testing (==, !=)
  • order relations (<, <=, >, >=)
  • boolean logic (!, &&, ||)
  • bitwise logic (~, &, |, ^)
  • bitwise shifts (<<, >>)
  • assignment (=, +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=)
  • increment and decrement (++, --)
  • reference and dereference (&, *, [ ])
  • conditional evaluation (? :)
  • member selection (., ->)
  • type conversion (( ))
  • object size (sizeof)
  • function argument collection (( ))
  • sequencing (,)
  • subexpression grouping (( ))

Usage of Unicode in C

http://www.cl.cam.ac.uk/~mgk25/unicode.html#c

Use the variable type wchar_t instead of char. (In C++ you would use std::wstring instead of std::string).

To enter a Unicode string prepend the letter L:

#include <stdio.h>
#include <locale.h>

int main()
{
  if (!setlocale(LC_CTYPE, "")) {
    fprintf(stderr, "Can't set the specified locale! "
            "Check LANG, LC_CTYPE, LC_ALL.\n");
    return 1;
  }
  printf("%ls\n", L"Schöne Grüße");
  return 0;
}

Resources

Comments