Functions without return types or arguments?

0 Cardinal Coog · January 1, 2015
Typically we think of a C++ function as:

[return type] [functionName](arguments){define function}

Ex.1

void printSomething(){
 cout << "This is a line of text." << endl;
}

OR

ex. 2

int main(){
return 0;
}

Why do we not use a return type with a function like:

srand(time(NULL));

OR

srand(time(0));

We are also not defining the functions using {}.

Why is this?

Post a Reply

Replies

Oldest  Newest  Rating
0 Cardinal Coog · January 1, 2015
Thanks!!! You're absolutely right. I completely forgot that stdio.h, stdlib.h and time.h have the needed definitions. One of those "dumb blonde" moments. :D 
  • 1

C++

107,021 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator