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,

Recommended Answers

All 4 Replies

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

Missing ; after } for class prototype:

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

Missing ; after } for class prototype:

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

Remark: this constuct called class definition in C++.

:$ You are absolutely right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.