OMG can some please help?

This is a discussion on OMG can some please help? within the C++ Programming forums, part of the General Programming Boards category; yah i didnt mean too. I was trying to post a img there and the [img] tags apparently dont work ...

  1. #16
    Programmer in Training TWIXMIX's Avatar
    Join Date
    Feb 2004
    Posts
    57
    yah i didnt mean too.
    I was trying to post a img there and the [img] tags apparently dont work so i tried to edit and delete but I had to put soemthing do i put that
    Learning C++
    Programmer in training

  2. #17
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    You can delete your posts. Just hit edit, check the delete this post box, and then hit the delete button.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #18
    Programmer in Training TWIXMIX's Avatar
    Join Date
    Feb 2004
    Posts
    57
    ook thx
    Learning C++
    Programmer in training

  4. #19
    Registered User caroundw5h's Avatar
    Join Date
    Oct 2003
    Posts
    751
    Originally posted by alphaoide
    Maybe, I guess, most likely, I don't do C.
    It just that when the function is called within the main, the compiler need to check if the parameters match. That's way if you define the function after the main(), the prototype is required before main().
    Code:
    #include<stdio.h>
    
    int mult(int x, int y){
       return x * y;
       }
    
      int main(void){
        int x = 3;
        int y = 2;
        int c = mult(x,y);
    
        printf("hello there 3 times 2 is %d, and i'm calling this function inside main without a prototype",
        c);
        getchar();
        return 0;
        }
    This code works fine . I compiled it with dev c++ 4.0.
    I suppose it makes sense since a #define macro can also be used as a fucntion and is defined outside of main.



    Maybe when the code is longer there are potential problems. The best bet of course is to follow ANSI standards and do your prototyping.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Omg Last Time I Swear!
    By unejam2005 in forum C++ Programming
    Replies: 3
    Last Post: 12-13-2005, 12:49 AM
  2. OMG!!! You guys!!!
    By RoD in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 04-04-2003, 10:17 PM
  3. omg lmao go to this link, it's funnay!
    By Shadow12345 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 12-07-2002, 06:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21