/*I am getting the following errors
free.cpp: In function 'int main()':
free.cpp:24: error: expected `;' before 'obj'
free.cpp:25: error: 'obj' was not declared in this scope
free.cpp:25: error: expected primary-expression before 'int'*/

#include<iostream>
using namespace std;
int array[]={0,1,2,3,4,5,6,7,8,9};

class free
{
	public:
	void function(int array[]);
};



void free::function(int array[])
{
	for (int i=1;i<=10 ;i++ )
	{
		cout<<array[i];
	}
}


int main()
{
free obj;
obj.function(int array[]);
 return 0;
}

/*I am getting the following errors
free.cpp: In function 'int main()':
free.cpp:24: error: expected `;' before 'obj'
free.cpp:25: error: 'obj' was not declared in this scope
free.cpp:25: error: expected primary-expression before 'int']

free is a reserved keyword in c++ and c. You need to name your class something else.

Thanks,now it is working.

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.