X applications require strong C programming skills, since they essentially involve object-oriented programming in a non-OOP language. How well do you know C?
Obviously, you can write C programs to find out the answers. But you should be able to answer most or all these "without cheating" if you are really ready for X programming. The best reference, by the way, is Harbison and Steele's C: A Reference Manual, published by Prentice Hall and available through the bookstore.
Argument coercion: Suppose your routine receives an unsigned long as its argument, but you need to use it as an integer. How would you coerce it?
Sending functions as arguments: Suppose your routine receives a pointer to a function as its first argument, as in the example
routine (foo, n);
int foo ();
int n;
{ ... code ... }
How will the code invoke that function, passing it the integer value as its
single argument?
Forward declarations: Under what circumstances do you need to make a forward declaration of a function? Any other data type?
C declarators: Typedefs and declarations are two instances of C statements that use "declarators"; typecasts also do. What is x, according to each of the following declarators?
int *x; int *x(); int **x; int **x(); int *x[10]();(Hint: don't be too sure you know, unless you are aware of the so-called right-left rule for C declarators.) If you're really confident, what is
int *(*(*(*x)()) [10]) ();This is from Harbison/Steele, p. 83.
struct a {int num1, num2;} a;
Padding of structures: Why is the size of the following two structures different? How would you prove it?
struct y {double big;
float med; int small;
char tiny; char tiny2};
struct z {double big;
char tiny; float med;
char tiny2; int small;};
Unions: What is the difference between the definition for y above, and this one?
union y {double big;
float med; int small;
char tiny; char tiny2};
How big is the union, in bytes?
Macro names: By convention, how do macro names usually differ from variable or function names?
Conditional compilation: How is this specified, and what is it for?