•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 455,993 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,798 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 413 | Replies: 2
![]() |
•
•
Join Date: Aug 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Im kinda new to programming, so my question is a simple one. I have came across term of data structures, and have been toying with some basic exsamples of them. While
Works perfectly fine, it shows an error whenever i try to get the "cout" part into a function
And I wonder why it happens, and how to pull it correctly.
Thank you for your help.
int *pointer [10];
struct cell{
int death;
};
int main ()
{
cell test;
cell * pointer[0];
pointer[0] = &test;
pointer[0] -> death = 5;
cout << pointer[0] -> death ;
cin.get();
return 0;
} Works perfectly fine, it shows an error whenever i try to get the "cout" part into a function
int *pointer [10];
struct cell{
int death;
};
int test() {cout << pointer[0] -> death;}
int main ()
{
cell test;
cell * pointer[0];
pointer[0] = &test;
pointer[0] -> death = 5;
test()
cin.get();
return 0;
} And I wonder why it happens, and how to pull it correctly.
Thank you for your help.
•
•
Join Date: Mar 2005
Location: Phnom Penh, Cambodia
Posts: 415
Reputation:
Rep Power: 5
Solved Threads: 36
int *pointer [10]; struct cell{ int death; }; int test() {cout << pointer[0] -> death;} int main () { cell test; cell * pointer[0]; pointer[0] = &test; pointer[0] -> death = 5; test() cin.get(); return 0; }
You've declared pointer twice.
Yesterday is a history, tomorrow is a mystery, today is a gift.
Behind every smile is a tear.
Visal .In
Behind every smile is a tear.
Visal .In
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- data structures in c++ (C++)
- Data Structures??? (C++)
- Why Data Structures???...QUESTIONS INSIDE (C++)
- Java Collections: ADTs, Data Structures & Algorithms (Java)
Other Threads in the C++ Forum
- Previous Thread: working with arrays and classes
- Next Thread: Algorithms


Linear Mode