Visual Studio 2013 C language // Writing files // Crashing -


// code should run // when run code, prompt enter number when press enter crashes. file.exe stopped working or // unhandled exception @ 0x0fbfe541 (msvcr120d.dll) in file.exe: 0xc0000005: access violation writing location 0x00000000.  #include<stdio.h> #include<conio.h>  void main() {      int n = 0;     file *f;      fopen_s(&f, "text.txt", "r+");      if (f == null)             printf_s("error!");      printf_s("enter number: ");     scanf_s("%d", n);      fprintf_s(f, "%d", n);       fclose(f);      _getch(); } 


Popular posts from this blog