Specifier

What is the specifier to specify long long integer with scanf? Thanks.

An example of what I mean is this, but with type integer:

1
2
3
  int i;
  printf("%s \n", "Print the number:");
  scanf("%d", &i);
Last edited on
@Thomas
Thank you. I looked at it, but can't understand which to use. What I have to look for?
Last edited on
This seems to work:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int main ()
{
//http://cboard.cprogramming.com/c-programming/92920-scanf-long-long.html
  long long int test;
  printf ("Enter long long int: ");
  scanf ("%I64d", &test);
  printf ("%I64d", test);

// cin >> test;
// cout << "\n\n" << test;


  system ("pause"); // remove if you don't use Visual Studio
  return 0;
}
@Thomas When I write the subscript I get the warning: warning: length modifier 'I64' results in undefined behavior or no effect with 'd' conversion specifier [-Wformat]

Isn't there other way? Thanks.
Last edited on
Use %lld.

1
2
long long i;
scanf("%lld", &i);
@Peter.
Thanks.
Topic archived. No new replies allowed.