I am trying to get a very simple and basic logic up and running using the C language. The following code gets it right on python, but I am not able to get the same results using C.
//Python Code
a = 2
while True:
a=a*2
print(a)
With the above Python code I am able to generate the particular sequence, but with the following C code I am not able to generate the same results.
//C Code
#include <stdio.h>
int main(){
long int a = 2;
while (1){
a=a*2;
printf(a);
}
return 0;
}
I am getting 0 infinitely. Why am I not able to get the sequence in C.
EDIT: I am running this program with slightly modified code on an Arduino, so I can't use printf.