-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Definine a estrutura header do modelo itf #26
O modelo itf será representado por duas estruturas de dados: O header com as dimensões do modelo e número de interfaces e um vetor de interfaces. A função initHeader faz a allocação dinâmica da estrutura header do modelo e retorna um ponteiro do tipo header para esta memória alocada.
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* estruturaModeloItf.c (C) | ||
* | ||
* Objetivo: Define a estrutura de dados do modelo itf. | ||
* | ||
* Site: https://dirack.github.io | ||
* | ||
* Versão 1.0 | ||
* | ||
* Programador: Rodolfo A C Neves (Dirack) 06/04/2020 | ||
* | ||
* Email: [email protected] | ||
* | ||
* Licença: GPL-3.0 <https://www.gnu.org/licenses/gpl-3.0.txt>. | ||
*/ | ||
|
||
#include <stdlib.h> | ||
#include <stdio.h> | ||
|
||
typedef struct Interface{ | ||
float* xedge; | ||
float* zedge; | ||
float sfill[3]; | ||
} interface; | ||
|
||
typedef struct Header{ | ||
int kedge; | ||
float xmin; | ||
float xmax; | ||
float zmin; | ||
float zmax; | ||
} header; | ||
|
||
header* initHeader( | ||
int kedge, | ||
float xmin, | ||
float xmax, | ||
float zmin, | ||
float zmax) | ||
{ | ||
|
||
header* h; | ||
h = (header*) malloc(sizeof(header)); | ||
h->kedge=kedge; | ||
h->xmin=xmin; | ||
h->xmax=xmax; | ||
h->zmin=zmin; | ||
h->zmax=zmax; | ||
return h; | ||
} | ||
|
||
void initInterface(){} | ||
|
||
int main(void){ | ||
header* h; | ||
h = initHeader(1,0,12,0,3.5); | ||
printf("kedge=%d\nxmin=%f\nxmax=%f\nzmin=%f\nzmax=%f\n", | ||
h->kedge, | ||
h->xmin, | ||
h->xmax, | ||
h->zmin, | ||
h->zmax); | ||
|
||
} |