why cant i get this int64 working? i compile with g++ -x c++ -o program source.c it keeps starting over with -2147483648 above 2147483647 ....
#include <stdint.h>
#include <inttypes.h>
#ifdef __cplusplus
#include <cstdio>
#include <cstdlib>
#include <cstring>
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
int main(int argc, char* argv[])
{
    int64_t i;
    for(i = 0; i < argc; ++i)
        printf("argv[%d]: %s\n", i, argv[i]);
    char string [512];
    int64_t a1 = atoi((const ch开发者_StackOverflow社区ar*) gets(string));
    int64_t limit = a1 + 99999999999
    while(a1 <= limit)
    {
        char command[10000];
        sprintf(command, "%d", a1);
        FILE* pFile = fopen ("myfile.txt","wa");
        fprintf (pFile, "%s\n", command);
        fclose (pFile);
       a1= a1 + 4321;
    }
    return EXIT_SUCCESS;
}
c
I think you should replace
sprintf(command, "%d", a1);
with
sprintf(command, "%lld", a1);
Using the wrong format specifier is undefined behaviour. AFAIK, using %d as the format specifier in gcc forces only 32 bits to be printed out - thus resulting in what looks like overflows in your output file.
int64_t limit = a1 + 99999999999;
Integer constant is too large.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论