Thread: question about functions

  1. #1
    I'm less than sure.... abyssphobia's Avatar
    Join Date
    Aug 2004
    Posts
    112

    Lightbulb question about functions




    ok This is my question , there are In c++ two kind of functions ,right????

    which the functions are ?, end what is the diference???


    Any help is welcome!!!!
    thx in adv.
    love,
    abyss
    Have I crossed the line?

  2. #2
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    Not sure what you mean by two types of functions. Maybe you mean functions that return a value and functions that don't ( procedures in some languages).
    silk.odyssey

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    It's like saying there are two types of people in this world. Those who like Neil Diamond, and those who don't. You can divide functions into any number of categories.

  4. #4
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    There are two types of functions in this world... Those that cause a segfault, and those that don't!

  5. #5
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    On a side note after that random outburst, don't worry about classifying such things. Instead, learn the parts of a function (return-type, owning class (if applicable), name, parameters, and body), and the difference between a declaration and a definition. If you understand how functions work this way, then any arbitrary distinctions between types won't matter.

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    40
    I think Silk had it. He probably means functions with return values and functions that just do what they do....(I'm not so good with the terminology....)
    Code:
    #include <iostream.h>
    int var;
    int test();
    int main() { 
     cout << "Please input your language:\n 1. C (C,C++,C#)\n 2. VB\n 3. Other\n";
     cin >> var;
     return test(); }
    int test() {  
     if(var == 1) {
      cout << "Y0u 4r3 t3h 1337\n";
      system("PAUSE");
      return main(); }
     else if(var == 2) {
      cout << "N00B3R!\n";
      system("PAUSE");
      return main(); }
     else if(var == 3) {
      cout << "You were not thought of.\n";
      system("PAUSE");
      return main(); }
     else {      
      return 0; }}

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Yeah, he probably does.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner's question about functions.
    By Crocodile23 in forum C Programming
    Replies: 4
    Last Post: 01-13-2009, 07:00 AM
  2. Functions Question
    By audinue in forum C Programming
    Replies: 2
    Last Post: 01-09-2009, 09:39 AM
  3. functions question.
    By Boozel in forum C Programming
    Replies: 1
    Last Post: 02-23-2008, 12:38 AM
  4. Question concerning functions
    By Warrax in forum C++ Programming
    Replies: 5
    Last Post: 04-04-2007, 11:00 AM
  5. Question about creating flash functions
    By jbh in forum C++ Programming
    Replies: 8
    Last Post: 11-21-2005, 09:39 AM