Questions tagged as 'c'

2
answers

Function to read file in C [closed]

What function to use in C to read file, line by line, and on each line contains different data types?     
asked by 31.05.2018 / 18:39
1
answer

How to check if the list is empty or with an element in C

typedef struct { int tamanho; nodo *inicio; } lista; typedef struct { lista **vet; int tamTabHash; int colisoes; } tabHash; tabHash *criaTabelaHash(int tamanho){ if(tamanho < 1) return NULL; tabHash* hash = (tabH...
asked by 04.07.2018 / 03:13
1
answer

Sort a list of students by name in alphabetical order

That's what I thought: Aluno *ordenarNome(Aluno *aluno){ Aluno *aux; Aluno *aux2 = (Aluno*)malloc(sizeof(Aluno)); Aluno *aux3 = (Aluno*)malloc(sizeof(Aluno)); Aluno *aux4 = (Aluno*)malloc(sizeof(Aluno)); Aluno *aux5 = (Alun...
asked by 19.05.2018 / 15:01
1
answer

Sorting an unordered list does not work

The code works to the extent that I have sort a list already created using a new list, but I can not identify the error. It was when I created the Sort and AddOrdenado functions that started to give error. #include <stdio.h>...
asked by 12.06.2018 / 15:32
1
answer

Insertion at the end of a chained list C

I'd like to know how to go through the list so that I can add a new one at the end of it, in the case at the position in the-> prox of the last one in this list. Here is my code: typedef struct lista { struct no *prim; } Lista; typedef str...
asked by 05.06.2018 / 08:09
1
answer

Pointer return that points to a local character vector?

#include <stdio.h> char *local(void); void main(void) { char *ponteiro = local(); printf("%s\n", ponteiro); /*Saida = - (*/ } char *local(void) { char nome[12] = "programador"; char *ponteiro = nome; return ponteiro;...
asked by 09.05.2018 / 05:29
3
answers

Check if a string is composed of digits

I want to check if my strings (which are stored in an array) are integers or not for example a for the fourth row of the array I have the following code. #include <stdio.h> #include <locale.h> #include <string.h> #include <...
asked by 08.06.2018 / 20:57
1
answer

How do I define an element of a struct in C? [closed]

I want to make a program that uses structs to store data, but that there is already some data inserted in it, I'll give a similar example: struct registro { char nome[30], telefone[11]; int idade }dados; In case I would need...
asked by 06.06.2018 / 21:13
1
answer

What causes the error "(.text + 0x5b5) undefined reference to 'printf'"?

#include <stdio.h> #define MAX 100 #define INVALIDO "Operção Inválida!\n" #define IDENT "A matriz é identidade\n" #define NAO_IDENT "A matriz não é identidade\n" #define SIMETRICA "A matriz é simétrica\n" #define NAO_SIMETRICA "A m...
asked by 07.06.2018 / 19:18
3
answers

Micro system of classes in C

Hello. I have a small problem that I can not resolve. What I would like to do is simply initialize a struct that receives function pointers automatically. For example: struct teste{ int x; int y; int (*soma)(int, int); }; typed...
asked by 25.05.2018 / 00:26