Search code examples
cmultiplication

Multiplying by i** is it possible in C? Like i++ why i**doesn't work in C?


Is it possible to multiply using i** in C? For example, I can increment i using i++. Why doesn't i** work in C?

#include <stdio.h>
int main(void)
{
    int result;
    for (int i = 2; i < 100; i**){
        result = i + 1;
        printf("%i\n", result);
    }


    return 0;
}

Solution

  • No, it's not possible. There is no operator like ** in C unlike unary increment (++) and decrement (--) operators. You should have try i *= i.