![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| printf | mirusnet | Shell Programming and Scripting | 4 | 01-23-2008 10:09 AM |
| printf question | hankooknara | Shell Programming and Scripting | 3 | 06-19-2007 01:28 AM |
| printf and imaxdif_t | grumpf | High Level Programming | 2 | 09-01-2006 04:03 AM |
| printf command in ksh | cin2000 | Shell Programming and Scripting | 1 | 12-21-2005 02:48 PM |
| Using printf to center | CSGUY | Shell Programming and Scripting | 2 | 04-19-2005 09:15 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
What is the output of the following program considering an x86 based parameter passing sequence where stack grows towards lower memory addresses and that arguments are evaluated from right to left:
int i=10; int f1() { static int i = 15; printf("f1:%d ", i); return i--; } main() { int i, j; i = 5; printf("%d %d %d", f1(), f1(), i); } |
|
||||
|
OKay, I'll bite. I'm not going to run any code.
Firstly the first i=10 is irrelevant, just like the j. The 1st call to f1() will return 15 and print "f1:15 ". The 2nd call to f1() will return 14 and print "f1:14 ". Then you will get "14 15 5", I reckon. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|