By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

prototyp declaration

P: 18
why do we need to use prototype for a function?
what does the header file contains?
why main function does not require any prototype declaration?
Nov 5 '06 #1
Share this Question
Share on Google+
2 Replies


P: 9
some functions returns values(like int,float) to the calling function.so the protype indicates which type it ireturns.

Lets assume int add()is some function used for addition........then this int represents ..... returns integer value.

int add()
{
c=a+b;
return c;
}

If a and b values are 2, 1.2 the addition becomes 3.2 it s an float value but this add function returns integer value to the caling function.

if protype is not defined means the default one is int(if the function returns any value)
in the case of main he default protype is void.void means it returns nothing(if function returns nothing means void is used).
Nov 5 '06 #2

Expert 100+
P: 1,510
there is good explaination of prototypes on URL
http://en.wikipedia.org/wiki/Function_prototype
Nov 5 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.