C syntax

Java’s syntax derives directly from that of C, so much code is mutually understandable, but some keywords have subtly different meanings.

basic types

The numerical types of C are not strictly defined, as opposed to those of Java. Rather, they depend on compiler settings and the underlying hardware.

char an 8-bit byte
short, int, long numeric, each not smaller than the last
unsigned sadly absent in Java
float, double, long double
enum like Java Enumeration
void a non-type: see uses of void

operators

pointer/array * & -> . []
logical && || !
sizeof
conditional ?:
comma ,

storage specifiers

static (Contrast with Javas static)

extern means the symbol’s definition is outside the current scope (often a bad idea)

structure declaration

struct A structure is like a class with only public member fields, but no member methods. Example

type definition

A type can be given another name with
typedef.
Especially useful to hide the internals of a type from client code: Example

type qualifier

const
Suggests that data referred to by a pointer shouldn’t be altered, but this is not strictly enforced. (Contrast with Java’s final)