Skip to content

Instantly share code, notes, and snippets.

@ctgnauh
Created April 6, 2023 11:37
Show Gist options
  • Select an option

  • Save ctgnauh/b1bffe4d721d59436c89c5b06e4cb8eb to your computer and use it in GitHub Desktop.

Select an option

Save ctgnauh/b1bffe4d721d59436c89c5b06e4cb8eb to your computer and use it in GitHub Desktop.

Revisions

  1. ctgnauh created this gist Apr 6, 2023.
    24 changes: 24 additions & 0 deletions lazyInStrict.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    #include <stdio.h>

    int firstFunction() {
    printf("First Function\n");
    return 0;
    }

    int secondFunctionWithArgumentOne(int one) {
    printf("Second Function\n");
    return one;
    }

    int theOne() {
    printf("One\n");
    return 1;
    }

    int main()
    {
    printf("This is the strict evaluation: \n");
    int foo = firstFunction() + secondFunctionWithArgumentOne(theOne());
    printf("\nThis is the short circuit evaluation: \n");
    return firstFunction() && secondFunctionWithArgumentOne(theOne());
    }