954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Passing stack to a function

hi,

How can i pass a stack to the function. I am getting compilation error. Following is my code.

class circuit
{
        public:
        int append_and_file(stack<int> &);
        /* Some other variables defined */
}

int circuit::unroll()
{
        append_and_file(add_stack_ppi);
}
int circuit::append_and_file(stack<int> &stack_ref)
{
	int var=0;
	int num_clauses = 0;
        stack_ref.push(2);
}

Please tell me what is wrong.

Thanks,

guest7
Junior Poster
109 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

Did you declare unroll?
Do you have the error log?
Did you even bother to read the forum rules; that you have violated?

MosaicFuneral
Posting Virtuoso
1,691 posts since Nov 2008
Reputation Points: 888
Solved Threads: 116
 

Missing ; after } for class prototype:

class circuit
{
public:
     int append_and_file(stack<int> &);
     /* Some other variables defined */
};
Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Missing ; after } for class prototype:

class circuit
{
public:
     int append_and_file(stack<int> &);
     /* Some other variables defined */
};


Remark: this constuct calledclass definition in C++.

ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
 

:$ You are absolutely right.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You