Write a function within certain requirements

Asked

Viewed 106 times

0

Can someone help me with the exercise below?

1) Write a function called update, which has no return (void), which will have four input parameters: (a) a pointer/reference to a structure of type DATA (see below), (b) an integer called day, (c) an integer called month, and (d) an integer called year. This function must update the day, month and year fields of the structure referenced by the first function parameter.

/* Estrutura DATA */
typedef struct
{
int dia;
int mes;
int ano;
} DATA;
/* Assinatura da função atualizar */
void atualizar(DATA* pontData, int dia, int mes, int ano) {

1 answer

1

struct Data {
    int dia;
    int mes;
    int ano;
}

void Atualizar(Data** data, int dia, int mes, int ano) {
    (*data)->dia = dia;
    (*data)->mes = mes;
    (*data)->ano = ano;
}

Is that it? If you need more information about what’s going on, leave a comment I’ll explain. I’m running out of time now, but any questions about the algorithm please let me know. Hugs!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.