Hello I am very new to C but have some experience with python and would like to know how to print the outputs for the credit.c so I know what I am dealing with. I have this code and when I get to the print statement I have an error and do not know how to fix this in C. This would be nice to debug easier.

#include <stdio.h>
#include <cs50.h>
int main(void)
long long int input, total;

    input = get_long_long();
while(input < 0);

total = input % 10;

I get the error

 --credit.c:15:12: error: incompatible integer to pointer conversion passing 
 'long long' to parameter of type 'const char *' [-Werror,-Wint-conversion]- 

It would be cool to figure this out so I am sure I know exactly what my code is doing. -Thanks

2 Answers 2


If you want to print a variable in C, you have to have a format code, much like formatted printing in python.

printf("%lli", total);

where "%lli" is the format specifier for a long long int.

  • Thanks for that! Commented Sep 23, 2018 at 17:43
  • You're welcome. Please 'accept' my answer to mark your question as solved.
    – curiouskiwi
    Commented Sep 23, 2018 at 20:14

long long p; { printf("%lli\n", p); }

when you need to print long long you must use %lli to represent long long

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .