Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

error: expected constructor, destructor, or type conversion before ‘int’

+3 votes
asked Nov 29, 2023 by Josvanth Krethik S (170 points)
#include <iostream>

using namespace std;

int val = 10;
divide (int)

int main()
    int val = 5;
    val = divide(::val/val);
    cout << ::val<<val;

int divide(int v)
 return v / 2;    

1 Answer

+1 vote
answered Nov 30, 2023 by Peter Minarik (88,520 points)

This has been answered in https://question.onlinegdb.com/15372/error-expected-constructor-destructor-conversion-before.

Replace line

divide (int)


int divide (int);
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.