| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | problem in c++ |
Hi Griffon
I might have missed the point with my last reply -
GC> struct unit {char ch;int i};
GC> class dim
GC> {
GC> unit *x;
GC> };
GC> x=new unit[]={...};
The above line won't work because you're trying to initialize a
pointer, not a structure. The line
struct unit y = {'c',1};
works ok, although neither BC++3.0 or BC++4 will allow
struct unit y;
y = {'c',1};
although the books I have don't say why.
But saying
struct unit *y = {'c',1};
is illegal.
The fact that you have the structure inside a class only
complicates things; the real problem is your attempting to
initialize a pointer with structure contents.
Hope this makes more sense...
Cheers
--- PPoint 1.88
* Origin: Silicon Heaven (3:711/934.16)SEEN-BY: 711/809 934 @PATH: 711/934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.