ArticleDirectory
- Longlong
- Example
- References
WriteProgramBecause a large integer is required, the Longlong type is required:
Longlong nlarge;
However, during formatting, you do not know what characters should be used. % d and % l cannot be used.
Longlong
Longlong is actually int64 type. In winnt. H, you can see:
Typedef _ int64Longlong;
Therefore, if you want to output the data, you need to see what format characters _ int64 uses. By checking msdn, we found that:I64.
In formatting the output, you also need to combine a D, that is, % i64d. For unsigned ulonglong, It is % i64u.
Example
Longlong nlarge= 9999999888;Wprintf(L"Longlong = % i64d \ n",Nlarge);Ulonglong ularge= 99999998777;Wprintf(L"Ulonglong = % i64u",Ularge);
The output is as follows:
Longlong = 9999999888.
Ulonglong = 99999998777
References
Format specification fields: printf and wprintf Functions
Http://msdn.microsoft.com/en-us/library/tcxf1dw6 (vs.71). aspx