Functions: Demo

Variables and data types
  • Ses4Functions Source Code

    #include <stdio.h>

    #include <stdlib.h>

     

    void greet();

    int add(int x, int y);

     

    int main(int argc, char *argv[]) {

        greet();

        greet();

        int r = add(10, 20);

        printf("10+20 = %d\n", r);

        r = add(1, 2);

        printf("1+2 = %d\n", r);

        return 0;

    }

     

    void greet() {

        printf("Welcome everyone to anyone can code C series\n");

    }

     

    int add(int x, int y) {

        int z = x + y;

        return z;

    }