1 votes 1 votes Why am i not getting any error while executing the following statements? int x=20; int z=x;//error expected but not coming int main() { int y=10; static int temp=y; //Error expected but not coming temp=99;//Error expected but not coming getch(); } Programming in C programming-in-c output static-single-assignment + – rahul sharma 5 asked Dec 28, 2016 rahul sharma 5 1.0k views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments air1 commented Dec 28, 2016 reply Follow Share where did you read that static variables can not be reinitialized in C? 0 votes 0 votes air1 commented Dec 28, 2016 reply Follow Share AFAIK only const variables can not b reinitialized. 0 votes 0 votes rahul sharma 5 commented Dec 28, 2016 reply Follow Share I read it somewhere that they are initialized only once.Doesnt it mean they cant be reinitialized? 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes static variable occupies memory at compile time but you r assigning the value which is created at run time RAJESHWAR YADAV answered Dec 28, 2016 RAJESHWAR YADAV comment Share Follow See all 3 Comments See all 3 3 Comments reply rahul sharma 5 commented Dec 28, 2016 reply Follow Share Yes,Thats why i am expecting error but it is not coming.I tried in dev c complier and one of the geeksforgeeks compiler?Are there any changes to these new compilers? 0 votes 0 votes RAJESHWAR YADAV commented Dec 28, 2016 reply Follow Share yes but slight changes 0 votes 0 votes rahul sharma 5 commented Dec 28, 2016 reply Follow Share So what is the conclusion?The statements I have commented are error statements right? 0 votes 0 votes Please log in or register to add a comment.