The declaration below:
static int *foo();
declares foo as a static function returning a pointer to an int.
What’s the purpose of declaring a function as static ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The function’s name isn’t visible outside the translation unit (source file) in which it’s declared, and won’t conflict with another function
fooin another source file.In general, functions should probably be declared
staticunless you have a specific need to call it from another source file.(Note that it’s only the name that’s not visible. It can still be called from anywhere in the program via a pointer.)