1 1 vote i am unable to understand how this extern int data type actually works here please help me to understand it?? Programming in C + – garimanand 662 views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply Vikas Verma commented Oct 8, 2018 reply Follow flag is 1 correct? 0 0 replyShare garimanand commented Oct 8, 2018 reply Follow flag yes 1 is correct, 0 0 replyShare Please log in or register to add a comment.
Best answer 1 1 vote defining "extern" is like giving a promise to the compiler that let me use it here as this variable is defined somewhere else and when you will use it you will get the memory reference. So using extern is only declaring that this variable is available somewhere. In this question we declared the variable $i$ but it was not intialized anywhere it does not have any memory allocated to it. So in the next line when the program executes $i=1024$ then it will get no memory reference to $i$ and will throw undefined reference $'i'$ Shobhit Joshi answered Oct 8, 2018 • selected Oct 8, 2018 by Shaik Masthan Shobhit Joshi comment Share Follow 0 reply Please log in or register to add a comment.