Post Reply 
C Evaluation
07-14-2022, 08:06 PM (This post was last modified: 07-14-2022 08:13 PM by toml_12953.)
Post: #1
C Evaluation
What should be printed by the code below? One compiler I used printed

reached f1
reached f2
2

Another printed

reached f2
reached f1
2

Which one is right? Here's the code:

Code:
#include <stdio.h>

short f1(){
    printf("reached f1\n");
    return (1);
}
short f2(){
    printf("reached f2\n");
    return (2);
}

void main(){
    short x;
    x = f1() * f2();
    printf("%d\n",x);
}

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
C Evaluation - toml_12953 - 07-14-2022 08:06 PM
RE: C Evaluation - Craig Bladow - 07-14-2022, 08:34 PM
RE: C Evaluation - cruff - 07-14-2022, 11:44 PM
RE: C Evaluation - Sylvain Cote - 07-15-2022, 01:12 AM
RE: C Evaluation - KeithB - 07-15-2022, 11:20 PM
RE: C Evaluation - ijabbott - 07-16-2022, 05:02 PM
RE: C Evaluation - robve - 07-16-2022, 06:43 PM



User(s) browsing this thread: 1 Guest(s)