Why am I getting a strange number in this code?

后端 未结 5 1459
甜味超标
甜味超标 2021-01-28 11:20

I want to write a C program that evaluates the factorials of the integers from 1 to 5 and print them in a tabular format. However, I keep getting a strange number over everythin

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-28 12:10

    printf("%d\t %d\n", &x, &factorial); &x and &factorial are addresses of those variables, not the variables themself. Omit the &.

提交回复
热议问题