Skip to content

Commit

Permalink
Definine a estrutura header do modelo itf #26
Browse files Browse the repository at this point in the history
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
Dirack committed Apr 6, 2020
1 parent b07274e commit 8f568cd
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions lib/estruturaModeloItf.c
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);

}

0 comments on commit 8f568cd

Please sign in to comment.