Questions tagged as 'c'

2
answers

split an array into multiple parts

Is there any way to access only a specific part of an array in c? For example, in python it is possible for me to access a specific part of an array. array[10] = 1,2,3,4,5,6,7,8,9,10 array[4:8] = 5,6,7,8 I wanted to know if there is somethi...
asked by 20.05.2014 / 04:03
1
answer

DevC ++ returns "source file not compiled". Because?

I can compile the file quietly, but when I run it it presents the source file not compiled. Could anyone help me? #include <stdio.h> #include <stdlib.h> #include <conio.h> int main () { float a, b, c, y; printf("\nDi...
asked by 28.05.2014 / 16:40
1
answer

Function that returns pointer crashes when it tries to return pointer to main program

I have this function that retrieves a record of a binary file already filled with records - such records are structured as node - and returns it to the program. However, in the return from "i" to the main program variable "test", the two being...
asked by 12.12.2014 / 15:45
1
answer

Array of pointers with struct

I am trying to assign 3 names to a string vector within a struct, and using pointers to reference the dynamically allocated struct, and then print and reverse it in a repeat structure, but when trying to print it it is not returned nothing....
asked by 10.11.2018 / 00:09
1
answer

Read a string from a file with space

Hello, I want to read a file line and then return the number of spaces as well, but first I'm trying to return the entire string but when I enter a space the rest of the string is not displayed after that. void LerArquivo() { FILE *fp; char st...
asked by 01.11.2018 / 01:41
1
answer

How to check if the vector of a record is empty in C

I have this record: typedef struct{ char nome[200], telefone[200], email[200]; } Agenda; Agenda contato; Agenda vetor[300]; And I want to print only those records that have data: int lista_contatos(void){ printf("========== Cont...
asked by 29.10.2018 / 15:55
1
answer

Problem with algorithm for removing duplicate numbers in double-chained list

Could someone help me with the following code? void removeRepetidos(Lista *l) { Elemento *aux = (*l); Elemento *aux2; Elemento *aux3; while(aux!=NULL) { aux2 = aux->prox; while(aux2 != NULL) {...
asked by 29.10.2018 / 00:37
1
answer

Problem with macro

I'm trying to solve the following exercise:    Type a program that defines and uses the PRINTARRAY macro to print   an array of integers. The macro should receive the array and the number of   elements in array as argument What I've done...
asked by 22.10.2018 / 00:59
1
answer

Why is my code in C using queue giving segmentation fault?

Hello, I have to implement a queue that receives the name and cpf information, but only when I try to dequeue something does it give a fault, without the line of the normal dialer, but I can not see the error in it. #include <stdio.h> #in...
asked by 20.10.2018 / 17:04
2
answers

Typecast in fopen for comparison with NULL

When I do a fopen, I always use an if for error correction. The pointers are declared in FILE *mestre, *indice; And I'm using it like this if (((mestre = fopen("//home//vitor//Desktop//mestre.bin", "ab"))==NULL) || ((indice = fopen("//...
asked by 24.06.2014 / 17:05