Posts by DiECC • 141 points
4 posts
-
4
votes3
answers12254
viewsA: How to initialize an array using pointers?
Four ways to zero a matrix come to mind, among them the easiest would be this: int matriz[5][5] = {0}; The normal, basic level, that would be: int matriz[5][5], i, j; for(i=0; i<5; i++) {…
-
2
votes9
answers2644
viewsA: Best practice for creating if
Among To and B, the most efficient would be To. But the best would be a third, a C: string mensagem; if(condicao) mensagem = "Adeus"; else mensagem = "OI"; But the efficiency of the algorithm…
-
1
votes3
answers23004
viewsA: How to pass a struct vector by reference parameter?
(scanf(" %s", (*dadosCliente+i).nome); The changes would need to be these: (scanf(" %s", (dadosCliente+*i)->nome); You de-reference the pointer i and then add to the first address of…
-
6
votes3
answers29291
viewsA: Creating your own header file
Header files, header files, are libraries, in them there is collection of functions. It is exactly the same as stdio.h, string.h and other commonly used libraries, including in the archive .c is…