What does this weird function definition mean?

opu 웃

I came across this C program in a blog post:

main()
{
    int n;
    n = 151;
    f(n);
}

f(x)
int x;
{
    printf("%d.\n", x);
}

The post doesn't explain it. Can anybody explain what this weird function definition means?

Yu Hao

This is the K&R style of C code, it's still valid C syntax, but I suggest you not using it in new-written code.

f(x)
int x;

is equivalent to ANSI C:

void f(int x)

K&R C is the C language described in the first edition of the book C programming language by Brian Kernighan and Dennis Ritchie, and named after the two authors. The second edition of the book updated to use ANSI C.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What does $;$ mean in a Perl function definition?

From Dev

What does the star mean in function definition like "function* ()"?

From Dev

What does the star mean in function definition like "function* ()"?

From Dev

What does star (*) mean in JavaScript function definition in Koa framework?

From Dev

What does the sharp (#) sign mean in a vim script function definition?

From Dev

What does the sharp (#) sign mean in a vim script function definition?

From Dev

What does this typedef definition mean?

From Dev

What does "leftmost" mean in that definition?

From Dev

What does the definition of BigDecimal mean?

From Dev

What does the definition of BigDecimal mean?

From Dev

What does <function at ...> mean

From Dev

What does this weird icon mean on Intellij?

From Java

What does the ampersand (&) mean in a TypeScript type definition?

From Dev

What does the following struct definition mean?

From Dev

What do the braces mean in the following function definition?

From Dev

Friend function in-class definition only allowed in non-local class definitions. What does it mean?

From Dev

Friend function in-class definition only allowed in non-local class definitions. What does it mean?

From Dev

what does this function do and what does it mean ?`

From Dev

What does `return function *(){...}` mean?

From Java

What does %>% function mean in R?

From Dev

What does "function*()" mean in nodejs?

From Dev

Javascript: what does function(_) mean

From Dev

"{}" what does this mean in the below function?

From Dev

In Python, what does '<function at ...>' mean?

From Dev

What does the "$$" mean in Postgresql function?

From Dev

what does "if (<name of a function>)" mean?

From Dev

What does "function(): any{" mean

From Dev

What does function() in jQuery mean?

From Dev

What does $(function() {}) mean in javascript

Related Related

  1. 1

    What does $;$ mean in a Perl function definition?

  2. 2

    What does the star mean in function definition like "function* ()"?

  3. 3

    What does the star mean in function definition like "function* ()"?

  4. 4

    What does star (*) mean in JavaScript function definition in Koa framework?

  5. 5

    What does the sharp (#) sign mean in a vim script function definition?

  6. 6

    What does the sharp (#) sign mean in a vim script function definition?

  7. 7

    What does this typedef definition mean?

  8. 8

    What does "leftmost" mean in that definition?

  9. 9

    What does the definition of BigDecimal mean?

  10. 10

    What does the definition of BigDecimal mean?

  11. 11

    What does <function at ...> mean

  12. 12

    What does this weird icon mean on Intellij?

  13. 13

    What does the ampersand (&) mean in a TypeScript type definition?

  14. 14

    What does the following struct definition mean?

  15. 15

    What do the braces mean in the following function definition?

  16. 16

    Friend function in-class definition only allowed in non-local class definitions. What does it mean?

  17. 17

    Friend function in-class definition only allowed in non-local class definitions. What does it mean?

  18. 18

    what does this function do and what does it mean ?`

  19. 19

    What does `return function *(){...}` mean?

  20. 20

    What does %>% function mean in R?

  21. 21

    What does "function*()" mean in nodejs?

  22. 22

    Javascript: what does function(_) mean

  23. 23

    "{}" what does this mean in the below function?

  24. 24

    In Python, what does '<function at ...>' mean?

  25. 25

    What does the "$$" mean in Postgresql function?

  26. 26

    what does "if (<name of a function>)" mean?

  27. 27

    What does "function(): any{" mean

  28. 28

    What does function() in jQuery mean?

  29. 29

    What does $(function() {}) mean in javascript

HotTag

Archive