where to declare structures, inside main() or outside main()?

前端 未结 3 1887
春和景丽
春和景丽 2021-02-04 12:39

Case 1: structure declared outside main() working fine

#include
#include
struct prod
{
    int price,         


        
3条回答
  •  清歌不尽
    2021-02-04 13:00

    It have to do about scoping, when you define the structure inside the main function then it's only defined in the scope of the main function, so the billamt function can't know about it.

提交回复
热议问题