C Function Calls

Beginner
6 min read
Updated: Nov 2026
1 example

What Is Function Calls?

A call transfers control to a function, passes argument values, and resumes after the function returns. A call that returns a value is an expression, so calls can be nested. The evaluation order of arguments is unspecified.

Remember
result = add(2, 3);              /* store result  */
print_report();                  /* ignore result */
total = add(add(1, 2), mul(3, 4));/* nested calls  */

Cheat Sheet

Keep these facts handy while you work with Function Calls in C.

TopicDetail
ArgumentsEvaluated, then copied to parameters
ReturnControl and value return to the call site
Ignore resultAllowed (cast to (void) to show intent)
OrderArgument evaluation order is unspecified

C Examples

Compile each example with gcc file.c -std=c11 -Wall -o out. Next: Parameters and Arguments.

Example 1 — Nested function calls

Inner calls run first and feed the outer call.

C
#include <stdio.h>

int add(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }

int main(void) {
    int total = add(add(1, 2), mul(3, 4));
    printf("add(add(1, 2), mul(3, 4)) = %d\n", total);
    return 0;
}

How It Works

  1. add(1, 2) returns 3 and mul(3, 4) returns 12.
  2. The outer add(3, 12) returns 15.
  3. Do not depend on whether add(1, 2) or mul(3, 4) runs first.

Edge Cases & Pitfalls

Check these before relying on Function Calls in real programs.

order

Side effects in arguments

f(i++, i++) has unspecified evaluation order. Compute values on separate lines.

ignore

Ignoring errors

Functions like fopen or malloc report failure through the return value. Check it.

Key Takeaways

  • Flow: call, run, return.
  • Nesting: inner calls evaluate first.
  • Order: argument order is unspecified.

One line: A call transfers control to a function, passes argument values, and resumes after the function returns.

Frequently Asked Questions

Arguments are evaluated and copied into the parameters, control jumps to the function body, and on return the call expression takes the returned value.
Yes. The result is simply discarded.
Continue with "C Parameters and Arguments" next. Understand formal parameters, actual arguments, and conversions. The C Functions hub lists every topic in order.

Next: Parameters and Arguments

Understand formal parameters, actual arguments, and conversions.

Continue →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful