Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /*
- * File: main.c
- * Author: mnunes
- *
- * Created on 29 de Janeiro de 2019, 16:38
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- /*
- *
- */
- int main(int argc, char** argv) {
- struct
- {
- int idTurma;
- char *alunos;
- } Turma;
- char *alunoLista;
- int qtd, idTurma;
- char aluno[40];
- printf("\t\tPrograma para adicionar a turma e os seus alunos\t\t\n\n");
- printf("Qual o numero da turma?\n");
- scanf("%d", &idTurma);
- printf("Quantos alunos a turma %d tem?\n", idTurma);
- scanf("%d",&qtd);
- alunoLista = malloc(sizeof(aluno));
- for(int i=0;i<qtd;i++)
- {
- printf("Digite o Nome do Aluno: \n");
- gets(aluno);
- alunoLista[i] = aluno;
- }
- Turma.idTurma = idTurma;
- Turma.alunos = alunoLista;
- return (EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement