scanf format warning for double

前端 未结 4 1580
隐瞒了意图╮
隐瞒了意图╮ 2021-01-26 16:46

I\'m having a small problem with a program I\'m working on, I keep getting the warning format \'%1f\' expects type \'float *\' but argument 2 has type \'double *\'

4条回答
  •  忘掉有多难
    2021-01-26 16:57

    Use scanf("%lf", n1) for double; Note the "l" (el, not "one"). If you are new to programming, try to get familiar with documentation, e.g. cppreference. There you find, for example, the matrix of format and length specifies for scanf.

    Have fun with learning programming, use google et al, and don't hesitate to ask :-)

提交回复
热议问题