Quick actions

cmd+k|ctrl+k

Navigation

Languages

Передача аргументов функции

Snippet info

Language

C

Visibility

public

Author

blackcoffee

Created

2018-07-06T14:18:11Z

Updated

2018-07-07T23:01:40Z

#include <stdio.h>

void display(char str[]);
int square(int x);
int cube(int y);

int main() {
    int num;
    char msg[50] = "String to be passed to a function";
    
    display(msg);
    num = square(4);
    
    printf("4 x 4 = %d\n", num);
    printf("4 x 4 x 4 = %d\n", cube(4));
    
    return 0;
}

void display(char str[]) {
    printf("%s\n", str);
}

int square(int x) {
    return x * x;
}

int cube(int y) {
    return (y * y) * y;
}
INFO