Questions tagged as 'c'

1
answer

scanf does not stop in a loop

int main(){ char texto[1000]; do{ scanf("%[^\n]", texto); if(!fakeEquals(texto)){ if(palindromo(texto)){ printf("SIM\n"); }else{ printf("NAO\n"); } } }while(!fakeEquals(texto)); return...
asked by 19.08.2018 / 17:54
1
answer

Error in function to change characters

I have to create a function to make the exchange of some character. The exercise is this: 1. Build a function that receives a message, its size, and a and remove all occurrences of this character in the message putting * in its place. The func...
asked by 20.08.2018 / 17:27
1
answer

Error referencing struct with pointers

I'm trying to convert this algorithm down into language c but I having trouble calling the variable and assigning a value to the p.key = 1 of the struct element. Error Code: error: request for member 'key' in something not a structure o...
asked by 04.11.2018 / 00:41
1
answer

Malloc function error: sysmalloc: Assertion failed in C

I'm implementing a Red Black Tree in C, and when I go to allocate memory for the second node, it gives the error:    sysmalloc: Assertion [...] failed. Aborted (core dumped) I have already researched and imagined that when I allocate memo...
asked by 07.11.2018 / 04:27
1
answer

Problem dividing a string vector in C

I'm doing a program that needs you to find half a string vector, but that half can not cut any words, so that half would have to be the next space found after half. Soon after finding this half the program must divide the vector into 2 string ve...
asked by 02.07.2018 / 15:02
2
answers

Problems with If Else Statement chained in C language

I'm starting programming and I had a hard time understanding If Else in a chained way. I came across the following situation, when running the code only the first or second condition (If / Else) are possible to be true, regardless of the value...
asked by 24.08.2018 / 00:10
1
answer

Dereferencing pointer to incomplete type

How can I solve the "dereferencing pointer to incomplete type" problem? I can not find where the error is. Below are the statements. typedef struct{ int dia,mes,ano; }data; typedef struct { char matricula[10]; data _matricula; data...
asked by 14.06.2018 / 04:24
1
answer

Put string in an array of characters

I am learning character array and wanted to do a simple program in which I create a 200x100 character array, put a string at position 0 and print it out. This is part of a larger program I'm doing, but I need to understand how to insert a...
asked by 18.06.2018 / 19:44
2
answers

What's the difference in assigning an already started array to an uninitiated array?

char nome[10]; nome = "w" //Aqui ocorre um warning, por quê isso ? char nome_dois[10]; nome_dois[0] = "w" // Aqui e normal, como esperado. "w" is in a static memory? How much of% is in a dynamic or static memory? When I call...
asked by 25.05.2018 / 05:32
1
answer

Delete repeated elements of a vector in C

I have to make an algorithm in C that receives values from the users and the armzazena in 2 different vectors (X and Y) and then shows the union (all elements of X and Y without repetitions), the difference elements of X that do not exist in Y,...
asked by 28.05.2018 / 19:41