Home > Back-end >  0 x7c92e63c (ucrtbased. DLL) (located in vs. exe) caused by abnormal: 0 xc0000005: writing position
0 x7c92e63c (ucrtbased. DLL) (located in vs. exe) caused by abnormal: 0 xc0000005: writing position

Time:11-24

/* talkback. C -- -- presentation and user interaction */
#include
# include
# define DENSITY 62.4
Int main ()
{
Float weight, volume;
Int size, letters;
Char name [40].
Printf (" Hi, What 's your first name? \n");
Scanf_s (" % s ", name);
Printf (" % s, what 's your weight in pounds? \ n ", name);
Scanf_s (" % f ", & amp; Weight);
Size=sizeof the name;
Letters=strlen (name);
Volume=weight/DENSITY;
Printf (" well, % s, your volume is % 2.2 f cubic feet. \ n ", the name, volume).
Printf (" your first name from the % d letters, \ n ", letters);
Printf (" and we have % d bytes to store it. \ n ", size);
return 0;

CodePudding user response:

When scanf_s () to receive the string

Want to have the parameters of the buffer boundary value

Scanf_s instead (" % s ", name, sizeof (name));

CodePudding user response:

The compiler has to point out problems, scanf_s for name is missing, suggest the use of the building Lord learn scanf_s

 scanf_s (" % s ", name, 40). 
the length of the name is 40
  • Related