Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #define MAXNAME 30
- char* requestName(void);
- int main() {
- int i, quant;
- char *charVet[10];
- printf("Entre com a quantidade de nomes a ser inserida :\n");
- scanf("%d",&quant);
- for(i = 0; i <= quant; i++) {
- charVet[i] = requestName();
- }
- return 0;
- }
- char* requestName(void) {
- char name[MAXNAME],*token;
- gets(name);
- token = (char*)malloc(sizeof(char)*strlen(name));
- strcpy(token,name);
- return token;
- }
Advertisement
Add Comment
Please, Sign In to add comment