Interview Questions

C/C++ Questions only (ANSI/ISO Standard C)

C++ programming on UNIX, C++ Networking,C++ Algorithm Questions and Answers


(Continued from previous question...)

C/C++ Questions only (ANSI/ISO Standard C)

1. What is the ``ANSI C Standard?''

2. How can I get a copy of the Standard?

3. My ANSI compiler is complaining about prototype mismatches for

parameters declared float.

4. Can you mix old-style and new-style function syntax?

5. Why does the declaration "extern f(struct x *p);" give me a

warning message?

6. Why can't I use const values in initializers and array

dimensions?

7. What's the difference between const char *p and char * const p?

8. Why can't I pass a char ** to a function which expects a const

char **?

9. Can I declare main as void, to shut off these annoying ``main

returns no value'' messages?

10. But what about main's third argument, envp?

11. I believe that declaring void main() can't fail, since I'm

calling exit instead of returning.

12. The book I've been using always uses void main().

13. Is exit(status) truly equivalent to returning the same status

from main?

14. How do I get the ANSI ``stringizing'' preprocessing operator `#'

to stringize the macro's value instead of its name?

15. What does the message ``warning: macro replacement within a

string literal'' mean?

16. I'm getting strange syntax errors inside lines I've #ifdeffed

out.

17. What are #pragmas ?

What does ``#pragma once'' mean?

18. Is char a[3] = "abc"; legal?

19. Why can't I perform arithmetic on a void * pointer?

20. What's the difference between memcpy and memmove?

21. What should malloc(0) do?

22. Why does the ANSI Standard not guarantee more than six

case-insensitive characters of external identifier significance?

23. My compiler is rejecting the simplest possible test programs,

with all kinds of syntax errors.

24. Why are some ANSI/ISO Standard library routines showing up as

undefined, even though I've got an ANSI compiler?

25. Does anyone have a tool for converting old-style C programs to

ANSI C, or for automatically generating prototypes?

26. Why won't frobozz-cc, which claims to be ANSI compliant, accept

this code?

27. What's the difference between implementation-defined,

unspecified, and undefined behavior?

28. I'm appalled that the ANSI Standard leaves so many issues

undefined.

29. I just tried some allegedly-undefined code on an ANSI-conforming

compiler, and got the results I expected.

(Continued on next question...)

Other Interview Questions