3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by Hyperion
1

You simple write its name and pass it the arguments. For example:

#include <stdio.h>

int main(void) {

    /* printf *is* a function, and that's how we call all the other functions */
    printf("I am %d years old\n", 15);

    return 0;
}

Going a step further and tokenizing the function call, we get printf -- the function's name "I am %d years old\n" -- the function's first argument 15 -- the function's second argument

0

I hope the following code piece help:

void some_function1();
void some_function2(int);

void main()
{
	printf("in main.\r\n");
	some_function1();
	some_function2(10);
}

void some_function1()
{
	printf("in some_function1.\r\n");
}

void some_function2(int i)
{
	printf("in some_function2; parameter was %d .\r\n", i);
}

Output returned is

in main.
in some_function1.
in some_function2; parameter was 10 .
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.