•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 429,965 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 2,552 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: 2311 | Replies: 4
![]() |
•
•
Join Date: Jan 2007
Posts: 18
Reputation:
Rep Power: 2
Solved Threads: 0
i want to initialize an array(set all elements to 0) . The array is to be used by different functions which r defined outside the class. obviously i cant initialize it in the class. and if i do it in a constructor or main(), it isnt recognised by all the functions outside the class using it.
what do i do ? where do i initialize the array. Please help. this is just the thing holding me back.
what do i do ? where do i initialize the array. Please help. this is just the thing holding me back.
•
•
•
•
i want to initialize an array(set all elements to 0) . The array is to be used by different functions which r defined outside the class. obviously i cant initialize it in the class. and if i do it in a constructor or main(), it isnt recognised by all the functions outside the class using it.
Sure it is. You probably did it wrong if it's not working. Define what you mean by "it isnt recognised"
Age is unimportant -- except in cheese
•
•
Join Date: Feb 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
it shouldn't happen. try
#include <iostream>
int main () {
int test [5]={0};
cout<<test[0];
}![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Functions and Array help (C++)
- Help : Pointers to array of class objects . (C++)
- template array initialization (C++)
Other Threads in the C++ Forum
- Previous Thread: Enter string to the next line
- Next Thread: Program to display System date and Time in VC++ 6.0



Linear Mode