Declaration of a global array of structures in C

1

I created a cliente structure and the next idea would be to create an array clientes . My idea would be to declare the array clientes globally, so that all functions can interact without being passed as an input parameter. But as I am very beginner I do not know if it is a good practice.

    
asked by anonymous 21.12.2018 / 22:04

2 answers

1

In general, the correct thing is to pass everything as a parameter, everything that is global is lost in the organization. Of course, for something simple will not give a problem and may give the false sense of security, but when you start making real codes is getting complicated, so learn to do it right from the beginning. This is independent of your problem. It is rare to need something global and you need to have good command of the programming to use properly. In doubt, use parameters.

    
21.12.2018 / 22:10
1

As a beginner, I think it's best to use the same parameter, so you can get lost to control this global variable. Another tip that I do, research on "structs" is a simple way to understand and I think it gets more organized. Well you can define well without having to worry too much.

    
22.12.2018 / 02:36