Access violation writing location 0x00000000. reading int from keyboard

前端 未结 5 1975
悲&欢浪女
悲&欢浪女 2020-12-07 00:45

I am trying to read the input from a keyboard which i will use to create a set of multiplications. If i hardcode the integer to use then the program works fine however when

5条回答
  •  抹茶落季
    2020-12-07 01:29

    scanf("%d", multiple);
    

    should be:

    scanf("%d", & multiple);
    

    In other words, you need to give scanf a pointer to the thing you want to read into. This is a classic mistake in the use of scanf(), and one everyone makes from time to time, so remember this for the next time you make it :-)

提交回复
热议问题