#include<stdio.h>
#include<stdlib.h>
typedef struct pessoa {
char *nome;
int idade;
float salario;
char *cargo;
float tempo;
} PESSOA;
void Insere_elemento(PESSOA*dados);
void Imprime_dados(PESSOA*dados);
int main () {
PESSOA dados;
Insere_elemento(&dados);
Imprime_dados(&dados);
return 0;
}
void Insere_elemento(PESSOA*dados) {
dados
->nome
= malloc(20 * sizeof(char)); dados
->cargo
= malloc(20 * sizeof(char)); scanf("%[^\n]19s", dados
->nome
); scanf("%d", &dados
->idade
); scanf("%f", &dados
->salario
); scanf(" %[^\n]19s", dados
->cargo
); scanf("%f", &dados
->tempo
); }
void Imprime_dados(PESSOA*dados) {
printf("%d \n", dados
->idade
); printf("%.2f \n", dados
->salario
); printf("%s \n", dados
->cargo
); printf("%.2f \n", dados
->tempo
);
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3RkbGliLmg+Cgp0eXBlZGVmIHN0cnVjdCBwZXNzb2EgewoJY2hhciAqbm9tZTsKCWludCBpZGFkZTsKCWZsb2F0IHNhbGFyaW87CgljaGFyICpjYXJnbzsKCWZsb2F0IHRlbXBvOwoKfSBQRVNTT0E7CnZvaWQgSW5zZXJlX2VsZW1lbnRvKFBFU1NPQSpkYWRvcyk7CnZvaWQgSW1wcmltZV9kYWRvcyhQRVNTT0EqZGFkb3MpOwppbnQgbWFpbiAoKSB7CglQRVNTT0EgZGFkb3M7CglJbnNlcmVfZWxlbWVudG8oJmRhZG9zKTsKCUltcHJpbWVfZGFkb3MoJmRhZG9zKTsKCglyZXR1cm4gMDsKCgp9CnZvaWQgSW5zZXJlX2VsZW1lbnRvKFBFU1NPQSpkYWRvcykgewoJZGFkb3MtPm5vbWUgPSBtYWxsb2MoMjAgKiBzaXplb2YoY2hhcikpOwoJZGFkb3MtPmNhcmdvID0gbWFsbG9jKDIwICogc2l6ZW9mKGNoYXIpKTsKCXNjYW5mKCIlW15cbl0xOXMiLCBkYWRvcy0+bm9tZSk7CglzY2FuZigiJWQiLCAmZG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