Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23
  1. #11

    Quote Originally Posted by ChaosOrb View Post
    marcdaven: don't have C programming books to refer to? Naa ra jud na tanan answer sa libro or search sa google.

    Basic jud kaayo na nga mga questions, it would require less analysis than making a C program with nested loops.
    -----------
    Kung wala ko masayop, basin mao ni pasabot sa inyo maestra:
    Function Parameters:
    1. Pass by Value
    2. Pass by reference

    functions
    (depends on what you are going to return)
    return (value)
    Bro, nag ask man akong maestra about "Unsa pa ang paris sa FORMAL parameters? 2 Types ra na sila..."

    Then, wala pa ko ning palit ug book because I'm told nga dili pa daw namo kaayo magamit karon..

    Another thing, giusab napud niya ang question: "What happens to this kuno..

    Code:
    main()
    {
     .
     ..
     ...
     return 0;
    }

  2. #12
    error ni siya sa kasagaran nga compiler, "missing type specifier" pointing to your main()

  3. #13
    Quote Originally Posted by marcdaven View Post
    Bro, nag ask man akong maestra about "Unsa pa ang paris sa FORMAL parameters? 2 Types ra na sila..."

    Then, wala pa ko ning palit ug book because I'm told nga dili pa daw namo kaayo magamit karon..

    Another thing, giusab napud niya ang question: "What happens to this kuno..

    Code:
    main()
    {
     .
     ..
     ...
     return 0;
    }
    i think mu error ni cya kai ang "main()" wla mag ask ug return value. i think lng ha.

  4. #14
    Ahh... OK

    Then about sa parameters? Any enlightenment?

  5. #15
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    it's accepted, compiler will give you a warning message: "warning #2099: Missing type specifier; assuming 'int'." coz once upon a time, C did not have the void type.

  6. #16
    Quote Originally Posted by marcdaven View Post
    Bro, nag ask man akong maestra about "Unsa pa ang paris sa FORMAL parameters? 2 Types ra na sila..."
    Karon pa man ko ka.dungog ug "Formal" parameters oi. Ingna inyong maestra, ang pares sa "Formal" parameter kay "Informal" parameter. Bitaw kidding aside, I haven't heard, nga naay diay "Formal" parameter?

    Quote Originally Posted by marcdaven View Post
    Then, wala pa ko ning palit ug book because I'm told nga dili pa daw namo kaayo magamit karon..
    Whoever told you this is a fool. A good C Programming book is an essential tool if you want to learn C Programming. Unless you are born Genius, then you don't need a book.

    Might I recommend a few good read?
    -Problem Solving and Program Design in C by Jeri R. Hanly and Elliot B. Koffman
    -Teach Yourself C (search sa google, naa daghan reference, even free )
    -How to Program in C by Deitel & Deitel

    Try to secure a copy of the first book I recommend. You might find what you are looking for in that book.

    Quote Originally Posted by marcdaven View Post
    Code:
    main()
    {
     .
     ..
     ...
     return 0;
    }
    Based on what others have posted, they are correct. You'll get an error, read the explanation of MarkCuering(he is quite a skilled programmer on board).

    IMO, mag.error cya kay:
    *ang imong main function walay return type, unya at the end of your main function naay statement nga "return 0".
    *A general rule in C Programming, every function should return a value, yes include the main() function. If you don't want to return a value, then set the return type to void

    Am I correct MarkCuering?
    Last edited by ChaosOrb; 02-10-2010 at 11:59 PM.

  7. #17
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Code:
    void main() {  ...  }
    is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1.

    A conforming implementation accepts
    Code:
    int main() { }
    and
    Code:
    int main(int argc, char* argv[]) {}

    In C++, main() need not contain an explicit return statement. In that case, the value returned is 0, meaning successful execution. For example:
    Code:
    	
    #include<iostream>
    int main()
    {
         std::cout << "This program returns the integer value 0\n";
    }

    if you want your software to be portable, please make main return int. It does matter.


    Code:
    extern int main(int, char *[]);
    int argc;
    char *argv[MAXARGS];
    int status;
    ...

    Code:
    status = main(argc, argv);
    exit(status);

  8. #18
    Code:
    main()
    {
     .
     ..
     ...
     return 0;
    }
    ------------------------------------------
    I don't know about you guys, but i think their is no error
    with this one. In this case, main is by default int isn't it?
    Or is it just my compiler showing successfull compilation.

  9. #19
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    ERRORS are different from WARNINGS.,

    the code might give you some warning but not an error, but in some compilers that strictly following standards will disallow you. users can handle the level of warnings/errors in modern compilers.


    For C

    Under C89, main() is acceptable, although it is advisable to use the C99 standard, under which only these are acceptable:

    Code:
    int main ( void )
    Code:
    int main ( int argc, char *argv[] )


    For C++

    The following are acceptable uses:

    Code:
    int main ( int argc, char *argv[] )
    Code:
    int main ()

  10. #20
    see marcdaven, I stand corrected. I told you can count on MarkCuering

  11.    Advertisement

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

 
  1. Can anyone help me with my assignments?
    By nitwit in forum General Discussions
    Replies: 32
    Last Post: 11-05-2022, 03:07 PM
  2. Help me uninstall my Deep freeze program.
    By Kibir_Tidibir in forum Computer Hardware
    Replies: 10
    Last Post: 09-05-2011, 02:57 PM
  3. Replies: 81
    Last Post: 02-19-2010, 02:03 PM
  4. Replies: 16
    Last Post: 10-12-2008, 02:10 AM
  5. Replies: 12
    Last Post: 04-17-2008, 04:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top