C lang:Definition function

Posted enomothem

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C lang:Definition function相关的知识,希望对你有一定的参考价值。

Ax_note.

  • in parameter for show_n_char() is formal parameter
#include <stdio.h>
#include <string.h>
#define NAME "ENOMOTHEM, INC."
#define ADDRESS "101 Beijing China"
#define PLACE "Megapolis, CA 00000"
#define WIDTH 40
#define WJXNUM 40
#define SPACE ' '

// function protype
void show_n_char(char ch, int num);

int main(void)
{
    int spaces;
// function call
    show_n_char('A',WJXNUM);
    printf("
");
    putchar('
');
    show_n_char('*', WIDTH);
    putchar('
');
    show_n_char(SPACE, 12);
    printf("%s
", NAME);
    spaces = (WIDTH - strlen(ADDRESS)) / 2;

    show_n_char(SPACE, spaces);
    printf("%s
", ADDRESS);
    show_n_char(SPACE, (WIDTH - strlen(PLACE)) / 2);

    printf("%s
", PLACE);
    show_n_char('*', WIDTH);
    putchar('
');

    return 0;
}
//function definition
void show_n_char (char ch, int num)
{
    int count;

    for (count = 1; count <= num; count++)
        putchar(ch);
}

技术图片

以上是关于C lang:Definition function的主要内容,如果未能解决你的问题,请参考以下文章

1336 - Sigma Functio

text 保存自https://wpshout.com/learning-php-for-wordpress-development-introduction-to-php-functions/

text 保存自https://wpshout.com/learning-php-for-wordpress-development-introduction-to-php-functions/

text 保存自https://wpshout.com/learning-php-for-wordpress-development-introduction-to-php-functions/

text 保存自https://wpshout.com/learning-php-for-wordpress-development-introduction-to-php-functions/

jquery.min.js?v=2.1.4:4 Uncaught TypeError: (b.contentType || "").indexOf is not a functio