I have c++ functions in which all the arguments are integers....I was wondering if there was a way of telling the computer this, other than typing int before each and every variable....I tried
function S(int a, b,c..)
but did not work....

I have c++ functions in which all the arguments are integers....I was wondering if there was a way of telling the computer this, other than typing int before each and every variable....I tried
function S(int a, b,c..)
but did not work....

Short answer...No, you can't. You have to specify a type for every parameter passed into a function, even if there are more than one of the same type.

Inside a function body, you can define local variables of the same type like so:

int main()
{
    int a, b, c, d, e;
    // Some code here........
}

But for function declarations and definitions, you have to specify the type for each parameter:

void myFunc(int a, int b, int c, int d, int e);

Hope that clears things up for you.
Cheers for now,
Jas.

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.