473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to call function for array of object

I have declared an array of object book.(book[100]).I have also
defined function outside the class addrecord() which is adding record
in for loop.Now in main() i want to call addrecord funcion for my
objects.how can i do so ?
Jul 19 '05 #1
3 6475

"shan" <ss*******@hotmail.com> wrote in message
news:3b*************************@posting.google.co m...
I have declared an array of object book.(book[100]).I have also
defined function outside the class addrecord() which is adding record
in for loop.Now in main() i want to call addrecord funcion for my
objects.how can i do so ?


Show us your code, otherwise we're only guessing.

-Mike
Jul 19 '05 #2
"shan" <ss*******@hotmail.com> wrote...
I have declared an array of object book.(book[100]).I have also
defined function outside the class addrecord() which is adding record
in for loop.Now in main() i want to call addrecord funcion for my
objects.how can i do so ?


Impossible to tell without seeing how 'addrecord' is declared.
In the future prefer posting C++ to English.

Victor
Jul 19 '05 #3
Faz
"shan" <ss*******@hotmail.com> wrote in message
news:3b*************************@posting.google.co m...
I have declared an array of object book.(book[100]).I have also
defined function outside the class addrecord() which is adding record
in for loop.Now in main() i want to call addrecord funcion for my
objects.how can i do so ?


Maybe you mean something like this :

class Book { /**/ };

const int MAX = 100;
Book book [MAX];

void addrecords( int COUNT ){

assert( COUNT <= MAX ); //Sanity check

for( int i = 0; i<COUNT; ++i ){
Book nextbook;

/* Setup nextbook somehow */

book[i] = nextbook;
}
}

int main(){

addrecords( MAX );

}

This is just a guess..
:)
Faz
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: chirs | last post by:
I am trying to understand a piece of code. In a javascrpit file, there is a function: function ItemStyle(){ var names=; addProps(this,arguments,names,true); }; In the html file, it calls...
2
by: ip4ram | last post by:
I used to work with C and have a set of libraries which allocate multi-dimensional arrays(2 and 3) with single malloc call. data_type **myarray =...
6
by: surrealtrauma | last post by:
i have a trouble about that: i want to ask user to enter the employee data (employee no., name, worked hour, etc.), but i dont know how to sort the data related to a particular employee as a...
9
by: Netocrat | last post by:
Any comments on the correctness of the statements 1, 2a, 2b, 3 and 4 in the code below? If they are correct, then the definition of an object as well as that of an lvalue is broken in C99 by the...
7
by: Bonzo | last post by:
>From within a function, I want to pass a/some parameters to another function, AND all arguments, passed into this function. e.g. function firstFunction(){ //this function may have been...
4
by: golubovsky | last post by:
Hi, Is there an easy way to construct a function call out of a function and an array of actual arguments? e. g. given a function `fun' and an array I need to obtain equivalent of...
4
by: Flic | last post by:
Hi, I am a relative beginner with php and have run into the problem in the subject line. I wonder if anyone could point out what the problem is as I have tried a few different things and it still...
10
by: ravi | last post by:
Hi, i am a c++ programmer, now i want to learn programming in c also. so can anybody explain me the difference b/w call by reference and call by pointer (with example if possible).
12
by: Rahul | last post by:
Hi Everyone, I have the following code and i'm able to invoke the destructor explicitly but not the constructor. and i get a compile time error when i invoke the constructor, why is this so? ...
4
by: Ty | last post by:
Hello all, I am creating a web site with Visual Stuido 2008. I am trying to use a java script file to create a busybox for login from this page http://blogs.crsw.com/mark/articles/642.aspx. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.