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
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
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
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().This code works fine . I compiled it with dev c++ 4.0.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; }
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.
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun