Why does using the wrong format specifier in C crash my program on Windows 7?

前端 未结 5 1579
后悔当初
后悔当初 2020-12-11 14:56

My program is as follows;

#include 
#include 

int main()
{
        char string[] = \"Gentlemen start your engines!\";
                


        
5条回答
  •  醉话见心
    2020-12-11 15:41

    Program crashes because formatting routine tries to access a string at address 0x0000001D which is the result of strlen() where is nothing like a string and likely there's no acessible memory at all.

提交回复
热议问题