๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ arithmetic-operators-in-c
Arithmetic Operators in C - GeeksforGeeks
C provides 9 arithmetic operators to work with numbers and perform different mathematical operations. These can be classified into two types based on the number of operands they work on:
Published ย  October 19, 2025
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_operators_arithmetic.php
C Arithmetic Operators
C Examples C Real-Life Examples C Exercises C Quiz C Code Challenges C Compiler C Syllabus C Study Plan C Interview Q&A C Certificate ... Arithmetic operators are used to perform common mathematical operations.
People also ask

What are the types of arithmetic operators?
It has various binary and unary operators. The binary operators include +, -, /, *, and %, along with unary operators like ++ and โ€“.
๐ŸŒ
testbook.com
testbook.com โ€บ home โ€บ gate โ€บ arithmetic operators in c: types, examples & practice problems
Arithmetic Operators in C: Types, Examples & Practice Problems
Can arithmetic operators be overloaded in C?
No, C does not support operator overloading. Operator overloading is available in C++.
๐ŸŒ
wscubetech.com
wscubetech.com โ€บ resources โ€บ c-programming โ€บ arithmetic-operators
Arithmetic Operators in C Language (Types With Examples)
Can arithmetic operators be used with negative numbers in C?
Yes, arithmetic operators can be used with negative numbers, and the results will follow the usual rules of arithmetic.
๐ŸŒ
wscubetech.com
wscubetech.com โ€บ resources โ€บ c-programming โ€บ arithmetic-operators
Arithmetic Operators in C Language (Types With Examples)
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ home โ€บ cprogramming โ€บ c arithmetic operators
C Arithmetic Operators
June 10, 2012 - Multi-dimensional Arrays ... Arithmetic operators in C are certain special symbols, predefined to perform arithmetic operations. We are familiar with the basic arithmetic operations โˆ’ addition, subtraction, multiplication and division.
๐ŸŒ
WsCube Tech
wscubetech.com โ€บ resources โ€บ c-programming โ€บ arithmetic-operators
Arithmetic Operators in C Language (Types With Examples)
August 29, 2025 - Learn about Arithmetic Operators in C Language (Types With Examples). Understand their types and usage with clear examples for better coding skills.
๐ŸŒ
Unstop
unstop.com โ€บ home โ€บ blog โ€บ arithmetic operators in c | types & precedence (+examples)
Arithmetic Operators In C | Types & Precedence (+Examples)
May 12, 2025 - Arithmetic operators in C, including addition, subtraction, multiplication, division, modulus, etc., help us perform mathematical computations on operands.
๐ŸŒ
Testbook
testbook.com โ€บ home โ€บ gate โ€บ arithmetic operators in c: types, examples & practice problems
Arithmetic Operators in C: Types, Examples & Practice Problems
This modulus operator calculates the remainder obtained when one number is divided by the other. Any modulus operation will display the remainder of the first value divided by the second value. Thus, 21%5 will be 1, but 20% of 5 will be 0. To better understand how all the arithmetic operators function in the C program, let's walk through the following example:
๐ŸŒ
ScholarHat
scholarhat.com โ€บ home
Arithmetic Operators in C Programming
July 29, 2025 - C offers a total of 9 operators enabling users to execute arithmetic functions, like addition subtraction, multiplication, and more. In C, arithmetic operators have a simple syntax. To compute a result, they operate in between operands, which are variables or constants.
๐ŸŒ
Codedamn
codedamn.com โ€บ news โ€บ c programming
Arithmetic Operators in C
March 9, 2024 - Arithmetic operators are fundamental components of programming, allowing us to perform basic mathematical operations within our code. In the C programming language, these operators are not just symbols but tools that can manipulate and transform data, making them indispensable for solving problem...
Find elsewhere
๐ŸŒ
Programiz
programiz.com โ€บ c-programming โ€บ c-operators
Operators in C
April 27, 2022 - An operator is a symbol that operates on a value or a variable. For example: + is an operator to perform addition. In this tutorial, you will learn about different C operators such as arithmetic, increment, assignment, relational, logical, etc. with the help of examples.
๐ŸŒ
W3Resource
w3resource.com โ€บ c-programming โ€บ c-arithmetic-operators.php
C Programming: Arithmetic Operators with Examples
Arithmetic operators include +, -, *, /, %, which performs all mathematical manipulations. These operators can operate on any built-in data type allowed in C.
๐ŸŒ
Tutorial Gateway
tutorialgateway.org โ€บ home โ€บ c programming โ€บ arithmetic operators in c
Arithmetic Operators in C Programming
April 2, 2025 - Arithmetic operators in C include Addition, Subtraction, Multiplication, Division, and Modulus and they are binary operating on two operands.
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ arithmetic operators in c
Arithmetic Operators in C - Scaler Topics
November 7, 2023 - C arithmetic operators are the symbols that are used to perform mathematical operations on operands. Arithmetic operators can also be used to perform operations on any numeric data type, such as int, float, and double.
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2022 โ€บ 09 โ€บ arithmetic-operators-in-c-with-examples
Arithmetic Operators in C with Examples
For example, x + y is an addition arithmetic operation, where x and y are operands and + symbol is an arithmetic operator. C supports following arithmetic operators: It adds two operands. In the following example, we have two integer variables and we are finding the sum of these numbers using ...
๐ŸŒ
Test-king
test-king.com โ€บ blog โ€บ c-programming-an-overview-of-arithmetic-operators
C Programming: An Overview of Arithmetic Operators
Arithmetic operators in C are fundamental components of the C programming language that enable developers to perform basic mathematical operations. These operators are used to carry out operations such as addition, subtraction, multiplication, division, and modulus on numerical data.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ operators-in-c
Operators in C - GeeksforGeeks
C language provides a wide range of built in operators that can be classified into 6 types based on their functionality: The arithmetic operators are used to perform arithmetic/mathematical operations on operands.
Published ย  November 1, 2025
๐ŸŒ
Cppreference
en.cppreference.com โ€บ w โ€บ c โ€บ language โ€บ operator_arithmetic.html
Arithmetic operators - cppreference.com
First, operators &, ^, and | perform usual arithmetic conversions on both operands and the operator ~ performs integer promotions on its only operand.
๐ŸŒ
BYJUS
byjus.com โ€บ gate โ€บ arithmetic-operators-in-c
Types of Arithmetic Operators in C
August 1, 2022 - This modulus operator calculates the remainder obtained by one number divided by the other. Any modulus operation will display the remainder of the first value that gets divided by the second value. Thus, 21%5 will be 1, but 20% of 5 will be 0. Go through the following example to understand how all the arithmetic operators function in the C program:
Top answer
1 of 3
11

Short answer:

No, it's not possible. At least not the way you want.

Long answer:

No, you cannot. C simply does not support things like the eval function in Python. For those who does not know what it is, this will print "Hello":

s = "print('Hello')" # A string with the code we want to execute
eval(s)              # Evaluate the string s as python code and execute it

If you want to do something like that in C, well just forget it. It's not possible.

You can achieve something similar with function pointers. It will look really awkward if you're not used to function pointers, but it mimics what you're talking about. Although quite badly.

int add(int a, int b) { return a+b; }
int sub(int a, int b) { return a-b; }

// Function taking two int and returning int
typedef int (operation)(int, int);

int main(void) {
    operation *ops[UCHAR_MAX+1];
    ops['+'] = add;
    ops['-'] = sub;
    printf("Sum:  %d\nDiff: %d\n", ops'+', ops'-');    
}

This prints:

Sum:  8
Diff: 2

ops is an array of function pointers. More precisely, an "array 256 of pointer to function (int, int) returning int". So we're using a single character directly to index it.

One thing to look out for here is to make sure that no negative values are passed to ops. This could happen on a machine where char is signed as default.

If you want some safety in form of error handling, you could do something like this:

int error(int a, int b) {
    fprintf(stderr, "Function not implemented");
    exit(EXIT_FAILURE);
}

and then do:

operation *ops[UCHAR_MAX+1];
for(int i=0; i < sizeof ops/sizeof *ops; i++) 
    ops[i] = error;

ops['+'] = add;
ops['-'] = sub;

This method is not worth all this extra hassle if you only want to support four operations, but it can actually come in quite handy if you're writing an emulator. I watched a very interesting youtube playlist about writing a NES emulator. It's in C++, but very oldschool so if you know C, it's not hard to follow. He talks about function pointers in part 2.

https://youtu.be/F8kx56OZQhg

Note: Not my channel. I have absolutely nothing to do with it. Was hesitating because it could look like spam, but those videos are really interesting for a coder.

2 of 3
4

It is possible. See an example below

RPN calculator implies in some sort of stack. On identifying an operand you pop up two operands and does the operation.

I want to let a short example so I will shortcut some things...

our "stack"

I will assume integer operands only, but I think it is not hard to make it generic, by using the usual suspects, void*

This is the stack in the example

// stack
int pop()
{
    int val = 1 + rand()%1000 / (-1)*(rand()%2);
    printf("pop(): operand %d from stack\n", val);
    return val;
}

It just gets a random number in [-998,999] inclusive :)

the operations

// operations 
int divd(int A, int B) { return A / B; };
int mult(int A, int B) { return A * B; };
int sub(int A, int B)  { return A - B; };
int sum(int A, int B)  { return A + B; };

So we have something to test.

the syntax glue

Assuming the operator is a single char we can build a lookup-table indexed by the operator and put the functions there.

C was created precisely to write this kind of things.

    int (*the_fs[256])(int,int) = {0};
    the_fs['+'] = sum;
    the_fs['-'] = sub;
    the_fs['*'] = mult;
    the_fs['/'] = divd;

a test

    // test for some cases
    const char oper[] = "+-*/";
    const int N = 8; 
    for (int i = 0; i < N; i += 1)
    {
        // do one test
        int ix = rand() % 4;
        printf("using '%c'\n", oper[ix]);
        a = pop();
        b = pop();
        printf("%d %c %d = %d\n", a, oper[ix], b, 
            the_fs[oper[ix]](a,b));
    }

It is just a matter of calling the_fs[X] where X is the operand. No need for if, no need for switch(). It can the used alo for unary operators, just PUSHing back the second operator in the function.

output for a random test with random numbers and random operations

using '+'
pop(): operand -624 from stack
pop(): operand -906 from stack
-624 + -906 = -1530
using '*'
pop(): operand -724 from stack
pop(): operand 1 from stack
-724 * 1 = -724
using '*'
pop(): operand -733 from stack
pop(): operand -807 from stack
-733 * -807 = 591531
using '-'
pop(): operand -938 from stack
pop(): operand 1 from stack
-938 - 1 = -939
using '*'
pop(): operand 0 from stack
pop(): operand -121 from stack
0 * -121 = 0
using '*'
pop(): operand 1 from stack
pop(): operand 1 from stack
1 * 1 = 1
using '-'
pop(): operand 1 from stack
pop(): operand -396 from stack
1 - -396 = 397
using '+'
pop(): operand -130 from stack
pop(): operand -372 from stack
-130 + -372 = -502

the complete test program

#include <stdio.h>
#include <stdlib.h>

int pop(); // stack simulator :)

int sum(int,int);
int sub(int,int);
int mult(int,int);
int divd(int,int);

int main(void)
{
    int        a      = 0;
    int        b      = 0; // the operands
    srand(210907);
    int (*the_fs[256])(int,int) = {0};
    the_fs['+'] = sum;
    the_fs['-'] = sub;
    the_fs['*'] = mult;
    the_fs['/'] = divd;

    // so you have an operator, and it is RPN
    // the stack must have 2 operands
    
    // test for some cases
    const char oper[] = "+-*/";
    const int N = 8; 
    for (int i = 0; i < N; i += 1)
    {
        // do one test
        int ix = rand() % 4;
        printf("using '%c'\n", oper[ix]);
        a = pop();
        b = pop();
        printf("%d %c %d = %d\n", a, oper[ix], b, 
            the_fs[oper[ix]](a,b));
    }
    return 0;
}

// stack
int pop()
{
    int val = 1 + rand()%1000 / (-1)*(rand()%2);
    printf("pop(): operand %d from stack\n", val);
    return val;
}

// operations 
int divd(int A, int B)  { return A / B; };
int mult(int A, int B) { return A * B; };
int sub(int A, int B)  { return A - B; };
int sum(int A, int B)  { return A + B; };

/*
https: //stackoverflow.com/questions/69080130/
can-you-implement-arithmetic-operator-as-variables-in-c
*/
๐ŸŒ
Quora
quora.com โ€บ What-are-arithmetic-operators-in-C
What are arithmetic operators in C? - Quora
Answer (1 of 5): The Arithmetic operators are some of the C Programming Operator, which are used to perform arithmetic operations includes operators like Addition, Subtraction, Multiplication, Division and Modulus.