what is the use of ‘auto’ keyword?

Answer Posted / vatsava

scope of the auto keyword is local to the block in which
the variable is defined.

for ex:
main()
{
auto int i=1;
{
auto int i=2;
{
auto int i=3;
printf("%d",i);
}
printf("%d",i);
}
printf("%d",i);
}
the op would be 321

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the data segment that is followed by c?

613


What are local static variables? How can you use them?

647


Explain what is the difference between functions getch() and getche()?

608


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

668


how we can make 3d venturing graphics on outer interface

4011






main() { printf("hello"); fork(); }

697


plz let me know how to become a telecom protocol tester. thank you.

1742


What is the process of writing the null pointer?

607


What is the difference between if else and switchstatement

1312


What are the advantages of using macro in c language?

592


Explain what does it mean when a pointer is used in an if statement?

617


What are the different types of constants?

640


Describe newline escape sequence with a sample program?

657


How would you rename a function in C?

622


main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none

726