|
-
June 5th, 2002, 08:29 AM
#1
C Exam questions
A friend of mine (yes really!) is looking doing a C course, and has had the following exam questions amongst others.
1) What is the difference between:
a) char *p[];
b) char (*p)[];
2) Can a char[4] contain the string "main"?
Question 1a is an array of char pointers, I think 1b is a pointer to an array. Do you agree?
Question 2 I feel is a lot more contentious. The exam paper wanted a one word answer (yes/no) I believe the answer is vague. It is no if you want to store a null termintated string, but strictly speaking the 4 characters can be held in an array of four chars especially if you know the lenght of the array is 4.
There are also another 30 off questions but these are relatively simple.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|