Click here to Skip to main content
15,905,616 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to implement automatic variables and also what are those????
Posted
Comments
nv3 27-Feb-13 3:14am    
Ever got to page 2 of your C language manual?

This question in not completely incorrect, but can be greatly improved. You should have re-formulated it:

"What are Wikipedia, Google, CodeProject and StackOverflow.com?"
If you asked and got good Answers, the Questions like your original one would not be needed!

This is not your first question of that sort. If you are going to proceed the same way, it won't take you far.

To start, please see: http://en.wikipedia.org/wiki/Automatic_variable[^].

By the way, another fallacy is learning separate notions. Nothing can replace systematic study of programming and languages.

—SA
 
Share this answer
 
Comments
nv3 27-Feb-13 3:16am    
Good answer, SA! I am waiting for the day when people start to ask: "What is the C language and what can it be used for?" :-)
H.Brydon 27-Feb-13 14:04pm    
Not to argue with your answer but C++11 now has a new use for the 'auto' keyword, which is not currently covered very well by Google. Yeah, I realize OP flagged "C" as language of choice, which is why I didn't answer...
Sergey Alexandrovich Kryukov 27-Feb-13 14:18pm    
Oh, it's an important point. Could you please explain this new use in a separate question; I'll gladly up-vote it, of course.
I think you mean C++11 "auto" used in type inherence and trailing return type? My fault, I did not think about it.

It's briefly explained here:

http://en.wikipedia.org/wiki/C%2B%2B11#Type_inference
http://en.wikipedia.org/wiki/C%2B%2B11#Alternative_function_syntax

If you can add to it, please post a separate answer; I credit you for this important point.

Thank you very much,
—SA
H.Brydon 28-Feb-13 9:44am    
Okay, good idea (done). Thanks for your comments.
Sergey Alexandrovich Kryukov 28-Feb-13 11:38am    
Great. Up-voted, commented.
And also thank you for finding the excuse for me. :-)
When I saw your comment about C++, I immediately saw I missed the point, but at that time I forgot that the question was about C only... :-)
—SA
You flagged "C" as your language of interest, but in C++ there is a new contextual meaning for "auto", where a variable's type (on the left of an equal sign) can be inferred from the expression (on the right of an equal sign). This is available in the latest "C++11" version of the language. For example, you can say
C++
auto x = 5;

and the compiler will determine that 'x' is an int. This is not (yet?) a feature of the "C" language.

I think Sergey's note in Solution #1 (here)[^] describes the details well.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 28-Feb-13 11:33am    
As I already said, this is an important point I missed. My 5.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900