tag:blogger.com,1999:blog-959939550345671470.post6216976539658080437..comments2024-03-24T12:51:18.535+05:30Comments on C programming Interview questions and answers: static variable in cPriyanka kumarihttp://www.blogger.com/profile/08145649011863585828noreply@blogger.comBlogger23125tag:blogger.com,1999:blog-959939550345671470.post-42540580080660526232016-05-26T20:30:30.427+05:302016-05-26T20:30:30.427+05:30The explanation is awesome.....thanks a lot The explanation is awesome.....thanks a lot PerfectPreacherhttps://www.blogger.com/profile/05682748523092830144noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-1497999180525641242016-05-08T02:14:10.567+05:302016-05-08T02:14:10.567+05:30I was wondering if you could tell me what this mea...I was wondering if you could tell me what this means as it is the name of a withdrawal from my bank account.<br /><br />OUTPUTON.C 39.95_VAnonymoushttps://www.blogger.com/profile/15795424031868935212noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-69676972858294588572016-05-08T02:07:03.621+05:302016-05-08T02:07:03.621+05:30This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/15795424031868935212noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-89984276557694733142015-08-05T22:10:12.577+05:302015-08-05T22:10:12.577+05:30But concepts are wrong... pls try to execute the p...But concepts are wrong... pls try to execute the prg your self u will find lots of error<br />Anonymoushttps://www.blogger.com/profile/00581355535015487872noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-46767212161969982752015-07-31T10:32:26.267+05:302015-07-31T10:32:26.267+05:30Here, it gives an output 25 but not zero because i...Here, it gives an output 25 but not zero because it has been initialized as 25 although it has been declared again as a local variable. <br />Anonymoushttps://www.blogger.com/profile/02938314461612704802noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-7413925960092277132015-06-15T15:02:25.772+05:302015-06-15T15:02:25.772+05:303. A same static variable can be declared many tim...3. A same static variable can be declared many times but we can initialize at only one time. For example:<br /><br />(a)<br />#include <br />static int i; //Declaring the variable i.<br />static int i=25; //Initializing the variable.<br />static int i; //Again declaring the variable i.<br />int main(){<br /> static int i; //Again declaring the variable i.<br /> printf(&Stock Market Learninghttps://www.blogger.com/profile/14493342741694770252noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-34600078473498064282015-03-04T17:59:10.265+05:302015-03-04T17:59:10.265+05:30int i; //Again declaring the variable i.
There is ...int i; //Again declaring the variable i.<br />There is no static keyword in front of the declaration. It is "another" i, an automatic, uninitialized i. The content of the memory area where it is placed is accidentally 43.Anonymoushttps://www.blogger.com/profile/02046838152563167432noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-20224002310385393952015-02-22T15:34:42.495+05:302015-02-22T15:34:42.495+05:30Why its giving output as : 43
Can anyone please e...Why its giving output as : 43<br /><br />Can anyone please explain it to me?<br />Thanx in advance ?<br /><br />#include <br />static int i; //Declaring the variable i.<br />static int i=25; //Initializing the variable.<br />static int i; //Again declaring the variable i.<br />int main(){<br /> int i; //Again declaring the variable i.<br /> printf("%d",i);<br Anonymoushttps://www.blogger.com/profile/09593790900873499431noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-76618056600724941852014-09-02T11:22:25.369+05:302014-09-02T11:22:25.369+05:30yes correct
yes correct<br />pravinhttps://www.blogger.com/profile/16704602526258619137noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-72243482191516560032014-06-16T16:59:10.548+05:302014-06-16T16:59:10.548+05:30All functions have extern as the default storage c...All functions have extern as the default storage class, so no you don't need to write it.Simashttps://www.blogger.com/profile/15703354950546919338noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-9934848642637333722014-05-19T19:29:39.163+05:302014-05-19T19:29:39.163+05:30brilliant explanation :Dbrilliant explanation :DAnonymoushttps://www.blogger.com/profile/06239239936537463956noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-15067415899661303302014-02-11T21:05:52.156+05:302014-02-11T21:05:52.156+05:30Yes you are correct in gcc I do get the same.
vija...Yes you are correct in gcc I do get the same.<br />vijayVijaihttps://www.blogger.com/profile/13573727865170539430noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-57460375997367482042013-04-07T11:11:32.340+05:302013-04-07T11:11:32.340+05:30This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/17909969157608834918noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-73985539845297054192013-02-25T20:58:36.480+05:302013-02-25T20:58:36.480+05:30that was a complete tutorial!! thanks brother!!that was a complete tutorial!! thanks brother!!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-10241225025833628142013-01-26T03:16:01.208+05:302013-01-26T03:16:01.208+05:30Ya thats correct actually it gives output as o.Ya thats correct actually it gives output as o.Anonymoushttps://www.blogger.com/profile/04370483675675345338noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-3443307458790699802012-02-25T01:38:07.378+05:302012-02-25T01:38:07.378+05:30i checked in vc++,it gives the error while compili...i checked in vc++,it gives the error while compiling /**error 'i' : redefinition; different storage class**/urvinderhttps://www.blogger.com/profile/04845375114968943693noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-38888501520412779092012-01-02T16:59:21.016+05:302012-01-02T16:59:21.016+05:30#include
static int i; //Declaring the var...#include <br />static int i; //Declaring the variable i.<br />static int i=25; //Initializing the variable.<br />static int i; //Again declaring the variable i.<br />int main(){<br /> static int i; //Again declaring the variable i.<br /> printf("%d",i);<br /> return 0;<br />}<br /><br />Output: 25<br /><br /><br />her if we compile output we should get 0 ranjithhttps://www.blogger.com/profile/13170446286749627323noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-73356498278850121062011-11-18T13:08:34.662+05:302011-11-18T13:08:34.662+05:30reaaly nice 1....commendablereaaly nice 1....commendableAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-15991651140938326382011-10-13T23:14:18.328+05:302011-10-13T23:14:18.328+05:30Thanks.Thanks.dinhpqhttps://www.blogger.com/profile/02076362924110387620noreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-18997761168021352412011-09-21T15:24:42.678+05:302011-09-21T15:24:42.678+05:30in the 8th point the visit() function must be decl...in the 8th point the visit() function must be declared extern in two.c .....correct me if i am wrong..??Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-33115249872943053492011-08-06T13:46:19.622+05:302011-08-06T13:46:19.622+05:30in the 8th point we r learning the scope of static...in the 8th point we r learning the scope of static at out side of the files..Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-45930368519114225342011-06-16T12:23:24.574+05:302011-06-16T12:23:24.574+05:30In 8th point (b)part,you have called visit in one....In 8th point (b)part,you have called visit in one.c file but in two.c file you have not declared the extern keyword before its defination...can u plz tel me why?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-959939550345671470.post-38159523269060916112011-02-18T00:11:38.780+05:302011-02-18T00:11:38.780+05:30explanation is just fab.explanation is just fab.Aartinoreply@blogger.com