3
How do I store more than one name in a type variable char, why put, let’s assume name[20], I’m defining that she was given 20 characters, and not that she could receive 20 elements, the code I’m trying to test this, is this one.
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int i;
float tvendas[10], pvendas[10];
char nome[15];
int main(void){
setlocale(LC_ALL, "Portuguese");
for(i=0; i<=9; i++)
{
printf("%d° VENDEDOR | DIGITE O TOTAL DE VENDAS: R$ ", i+1);
scanf("%f", &tvendas[i]);
printf("%d° VENDEDOR | DIGITE O PERCENTUAL DE AUMENTO DAS VENDAS: ", i+1);
scanf("%f", &pvendas[i]);
printf("%d° VENDEDOR | DIGITE O NOME: ", i+1);
scanf("%s", nome[i]); // MEU PROBLEMA É AQUI
}
for(i=0; i<=9; i++){
printf("TESTE %s\n", nome[i]); //TESTANDO PARA VER SE OS NOMES APARECEM.
}
return 0;
}
wouldn’t be, for example: char nome[15][15];
– aa_sp
That’s right, thank you very much, I didn’t know you could do that.
– Paulo Sergio G.M. Filho
Blza, I’ll put in an answer to facilitate ;)
– aa_sp