Olá, gostaria de tirar uma duvida, estou fazendo um programa onde leio varios dados do tipo string de um arquivo txt e armazeno eles em um vetor, então gostaria de imprimir qual string mais se repete nesse vetor.
Vou postar oque fiz até agora, muito obrigado pela ajuda!
Codigo:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>#define T 255
// Prototipos void lerData(FILE *arquivo, char Vetor[T]); void lerPunicoes(FILE *arquivo, char Vetor[T]); void lerGeneros(FILE *arquivo, char Vetor[T]); void menuPrograma();int main() { // Cria ponteiro do arquvio FILE *file;// VARIAVEIS int Escolha; char Datas[T], Punicoes[T], Generos[T]; scanf("%d", &Escolha); switch (Escolha) { case 1: file = fopen("C:\\Users\\pedro\\OneDrive\\Files\\Dev\\C\\Projects\\Inquisicao\\TxT\\Datas.txt", "r"); lerData(file, Datas); break; default: printf("ESCOLHA INVALIDA!!"); break; } return 0;}
// Função para ler as datas void lerData(FILE *arquivo, char Vetor[T]) { while ( fgets(Vetor, T, arquivo) != NULL) { printf("%s", Vetor); }for (int i = 0; i < T; i++) { for (int j = i + 1; j < T; j++) { } }}