im not sure exactly what its called or how to use it.. but im guessing its used to pass over variables as arguments to a function, ive only seen it in functions with this added after it: ,...) somewaht similar to the code below..

int myfunc(char *data,const char *data2[B],...[/B])
{
    ....
    return 0;
}

int main(void)
{
    char varhold[21];
    memset(varhold,0,sizeof(varhold));
    sprintf(varhold,"bob");
    myfunc("hey","hi %s",varhold);
    return 0;
}

can someone tell me what it is? how to use it? examples?

Recommended Answers

All 4 Replies

im not sure exactly what its called or how to use it.. but im guessing its used to pass over variables as arguments to a function, ive only seen it in functions with this added after it: ,...) somewaht similar to the code below..

int myfunc(char *data,const char *data2[B],...[/B])
{
    ....
    return 0;
}

int main(void)
{
    char varhold[21];
    memset(varhold,0,sizeof(varhold));
    sprintf(varhold,"bob");
    myfunc("hey","hi %s",varhold);
    return 0;
}

can someone tell me what it is? how to use it? examples?

The 3 dots "..." are not part of C or C++. Presumably whichever book you are using is obscuring some of the function's definition... It might mean that whatever would be behind those 3 dots is unimportant to the example in your book, but that is just as guess

i am not reading any book, its part of the actual source in several opensource applications i have seen.. i am specifically taking it from Unreal 3.1, and if i dont have those three dots within the function it wont compile.. im just wondering what they do

It tells that function is variable argument function.

sunnypalsingh hit it right on the dot, thanks!
after searching google for a minute or so i found http://www.cprogramming.com/tutorial/c/lesson17.html (i probably should of checked there anyway before posting) which gives a bit of information on using argument lists in functions if anyone reading this cares or wants to know.

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.