• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

functions and storage class

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
void fun(auto int _){
print("%d",_);
}
main(){
fun(23);
return 0;
}

this program is giving me an error relating to storage class ,if we are using atatic in place of auto then also it is giving me an error,can somebody please explain me why i m getting an error in both the cases and how can i solve this error,thanks
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hopefully, you're not planning on using "_" as a variable name.

Paramters to functions can't accept "auto" or "static" as modifiers. You can solve your problem by not using those modifiers. This code is correct:




... though it still uses that terrible variable name.
 
reply
    Bookmark Topic Watch Topic
  • New Topic