C++ Help

Tarrant64

Diamond Member
Sep 20, 2004
3,203
0
76
I've got this take home quiz and I don't quite understand whether this would be anytime, or never:

When is it permissible to declare pointer variables within a structure (struct data type)?

- anytime, linked-lists use pointers (settled on this after talking to friend)
-only when all data elements are of type char
- never
- only when the struct data variables are declared locally

Can someone help me out?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Professors sometimes come up with the stupidest questions, don't they? Does he (or she) mean permissible syntactically? Then your answer is correct. More likely he (or she) means "permissible according to my personal system design principles," in which case, you'd know better than I.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Process of elimination rejects the other 3 options w/ respect to your bolded question
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
I would say what you marked, or never. But it really depends on what the professor has said in class (Like Mark said, whatever dumb standard they have concocted)

Ultimately, any of those answers could be correct depending on what he/she said in class. But it is certainly a bad/poorly worded question.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
I was thinking D, only because I never user pointers in my remotely declared structure type variables.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Originally posted by: degibson
Its B.

I have no problem using integer pointers or void pointers

The way B is worded is that only char can be pointers.
That is great with strings, but not so when using other data types.

 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
Originally posted by: degibson
Its B.

Oops. I thought the posts above me had firmly convinced you that the entire question was bogus. I added this because I wanted to stir the mud -- nothing more. Correct answer is A of course.