Friday

Cquest Placement Papers

1. Declarations and Initializations
1.1 How do you decide which integer type to use?

1.4 What should the 64-bit type on new, 64-bit machines be?

1.7 What's the best way to declare and define global variables?

1.11 What does extern mean in a function declaration?

1.12 What's the auto keyword good for?

1.14 I can't seem to define a linked list node which contains a
pointer to itself.

1.21 How do I declare an array of N pointers to functions returning
pointers to functions returning pointers to characters?

1.22 How can I declare a function that returns a pointer to a function
of its own type?

1.25 My compiler is complaining about an invalid redeclaration of a
function, but I only define it once and call it once.

1.30 What can I safely assume about the initial values of variables
which are not explicitly initialized?

1.31 Why can't I initialize a local array with a string?

1.32 What is the difference between char a[] = "string"; and char *p =
"string"; ?

1.34 How do I initialize a pointer to a function?

2. Structures, Unions, and Enumerations

2.1 What's the difference between struct x1 { ... }; and typedef
struct { ... } x2; ?

2.2 Why doesn't "struct x { ... }; x thestruct;" work?

2.3 Can a structure contain a pointer to itself?

2.4 What's the best way of implementing opaque (abstract) data types
in C?

2.6 I came across some code that declared a structure with the last
member an array of one element, and then did some tricky allocation to
make it act like the array had several elements. Is this legal or
portable?

2.7 I heard that structures could be assigned to variables and passed
to and from functions, but K&R1 says not.

2.8 Why can't you compare structures?

2.9 How are structure passing and returning implemented?

2.10 Can I pass constant values to functions which accept structure
arguments?

2.11 How can I read/write structures from/to data files?

2.12 How can I turn off structure padding?

2.13 Why does sizeof report a larger size than I expect for a
structure type?

2.14 How can I determine the byte offset of a field within a
structure?

2.15 How can I access structure fields by name at run time?

2.18 I have a program which works correctly, but dumps core after it
finishes. Why?

2.20 Can I initialize unions?

2.22 What is the difference between an enumeration and a set of
preprocessor #defines?

2.24 Is there an easy way to print enumeration values symbolically?

3. Expressions

3.1 Why doesn't the code "a[i] = i++;" work?

3.2 Under my compiler, the code "int i = 7; printf("%d\n", i++ *
i++);" prints 49. Regardless of the order of evaluation, shouldn't it
print 56?

3.3 How could the code [CENSORED] ever give 7?

3.4 Don't precedence and parentheses dictate order of evaluation?

3.5 But what about the && and || operators?

No comments: