tag:blogger.com,1999:blog-5531960551406702359.post5937039733588500427..comments2024-03-29T12:14:02.680+05:30Comments on C Programming | Computer | Ms-Excel: Compilation and execution of programsDinesh Berahttp://www.blogger.com/profile/17779626530091691900noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-5531960551406702359.post-756071109279881752016-01-24T15:43:23.863+05:302016-01-24T15:43:23.863+05:30can u plz send a flowchart representing how to exe...can u plz send a flowchart representing how to execute a c progrAM<br />Anonymoushttps://www.blogger.com/profile/11710154374609164447noreply@blogger.comtag:blogger.com,1999:blog-5531960551406702359.post-27146874018498076512015-03-07T20:58:40.053+05:302015-03-07T20:58:40.053+05:30awesome explanationawesome explanationAnonymoushttps://www.blogger.com/profile/02084658999736218246noreply@blogger.comtag:blogger.com,1999:blog-5531960551406702359.post-11042651133242359482014-06-24T09:52:03.876+05:302014-06-24T09:52:03.876+05:30Hi,
the statement num = ++i + ++i is an assignment...Hi,<br />the statement num = ++i + ++i is an assignment statement,<br />first the increment are done before the add operation.<br />Hence this i was incremented twice. So it becomes 2.<br />Then as per your statement num = i + i ; <br />So it become 4 as result.<br /><br />if you want to see the difference , <br />use j instead of i at one end.<br />int j = 0 ;<br />num = ++i + ++j ; <br />now see the difference.Karthickhttps://www.blogger.com/profile/05233783436032748984noreply@blogger.comtag:blogger.com,1999:blog-5531960551406702359.post-55092229655063205582014-06-23T20:28:01.531+05:302014-06-23T20:28:01.531+05:30#include
#include
void main(){
int num,i=0;
num=++...#include<br />#include<br />void main(){<br />int num,i=0;<br />num=++i+ ++i;<br />printf("%d",num);<br />}<br /> please explain how the answer becomes 4?kittyhttps://www.blogger.com/profile/16558620122999980135noreply@blogger.comtag:blogger.com,1999:blog-5531960551406702359.post-63035323764638048052013-12-19T10:48:06.569+05:302013-12-19T10:48:06.569+05:30you didn't understand my explanation which i h...you didn't understand my explanation which i had given above...<br />arr+8 -> This address it self contains only the null value. <br />So you got garbage value as output when using 0. the only value.<br /><br />then how can you get an index from this,<br />there should not be any value.<br /><br />try to assign the value to the (arr+8)[0] or .. (arr+8)[n] ,<br />then assign the same index to x.<br /><br />eg,<br />char arr[8]={'1','2','3','4','5','6','7','8'};<br />//arr[7] has the value 8. last value of array.<br /> (arr+8)[4]='5';<br /> int x=(arr+8)[4];<br /> printf("array: %s\n",arr);<br /> printf("new variable : %c",x);<br /><br />then print it it should the value which you assigned.<br />But this type of usage is not good, you should declare then you should use it.<br /><br />do more experimentation on the array index,Karthickhttps://www.blogger.com/profile/05233783436032748984noreply@blogger.comtag:blogger.com,1999:blog-5531960551406702359.post-74617916380262632812013-12-18T12:07:36.270+05:302013-12-18T12:07:36.270+05:30Hi karthick,
x=(arr+8)[0];output is garbage value
...Hi karthick,<br />x=(arr+8)[0];output is garbage value<br />x=(arr+8)[1];output is garbage value<br />x=(arr+8)[2 or 3 or 4 or -----] output is 0 <br />what is the reason?RVGMhttps://www.blogger.com/profile/08838948513229476592noreply@blogger.comtag:blogger.com,1999:blog-5531960551406702359.post-64960913204237971352013-12-17T10:02:08.394+05:302013-12-17T10:02:08.394+05:30Hi karthick,
x=(arr+8)[0];output is garbage value
...Hi karthick,<br />x=(arr+8)[0];output is garbage value<br />x=(arr+8)[1];output is garbage value<br />x=(arr+8)[2 or 3 or 4 or -----] output is 0 <br />what is the reason?<br />RVGMhttps://www.blogger.com/profile/08838948513229476592noreply@blogger.comtag:blogger.com,1999:blog-5531960551406702359.post-33480578742545993872013-11-14T12:52:04.674+05:302013-11-14T12:52:04.674+05:30It gives 0 as output.
Explanation:
...It gives 0 as output.<br /><br />Explanation:<br /> I think you may aware of arrays,<br />though your array name arr should has the address of index 0 (arr[0]).<br />let assume your array address starts from 100. so arr[0] & arr is 100.<br />you increment that location by 8. <br /><br />hence (arr+8) evaluated and has the result 108.<br /><br />you like to assign 3 rd index next to 108.<br />there is no data at that location so it returns 0.<br /><br />if you like to confirm that plz give the value less that 5 instead of 8.<br /><br />x=(arr+3)[3]; ----> 77<br />( note that the array value starts from 0). 3 index next to 4th,<br /><br />Hope you have an idea.<br />Karthickhttps://www.blogger.com/profile/05233783436032748984noreply@blogger.com