Questions tagged as 'c'

4
answers

Program to discover repeated characters in strings and print backwards

I need to find out how many and which repeated characters exist in a string (after informing it). And also print this string backwards. I'm in big trouble. Here is part of the code I have made so far, but with several errors. #include <stdi...
asked by 23.01.2018 / 19:39
1
answer

How to use free in a structure variable (chained list)?

I can not use free() in " struct Lista *proximo ". Here is my code: #include "stdafx.h" #include <stdlib.h> #include <conio.h> #include <locale.h> struct Lista { int num; struct Lista *proximo; }celula;...
asked by 23.01.2018 / 17:46
1
answer

Exchanging rows from an array

Below is my code. I need to change line 1 to line 3 and line 2 to line 4. The problem is that the third line is not changing and I do not find the problem. int matriz[TAM][TAM], n = 0, x = 0, y = 0, aux = 0, aux2 = 0, aux3 = 0; printf...
asked by 22.01.2018 / 14:31
1
answer

Character comparison error with strcmp

In the question you ask me to create a pair of Right and Left shoes so I used strcmp to compare, I used 1 because the strings have to be different, but I did not get the result that the question asked for. Link to the question link Here i...
asked by 28.12.2017 / 13:47
1
answer

How to limit decimal places?

printf("%.3f", &resp); I'm using the following line, however, when comparing with a number, it requires that it has the same decimal place as the originals, for example: 2.963258741 != 2.963 Can you limit the houses for this compari...
asked by 01.12.2017 / 05:21
1
answer

"[Error] expected expression before 'creature'" in function

The board is a "creature" of my struct: typedef struct{ int status; char classe; int saude; int def; int atc; char elixir; }criatura; No .h: void exibe(criatura tabuleiro[5][10]); // exibe o tabuleiro The call i...
asked by 11.11.2017 / 23:46
2
answers

How to analyze the input in the while condition?

I'm learning C, and as the language in which I was "literate" is Python, I usually make associations to assimilate better. In Python, I can get a direct value in the while condition. Ex.: while int(input()) != 0: faça isso It is also...
asked by 24.12.2017 / 05:25
1
answer

How to return integer value in pthread?

How to return an integer value and can show with printf using pthread? Here is an example of the problem: #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <pthread.h> vo...
asked by 31.10.2017 / 16:20
1
answer

Problems in String and Case

I'm a newcomer to programming recently and I have a college assignment where I have to create a registration system that receives input from customer data and then another option that prints the information on the screen. / p> But I'm having t...
asked by 22.10.2017 / 22:25
1
answer

Do I need to match a string array to another array, how do I?

#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 3 #define LEN 80 char texto[MAX][LEN]; int main(){ char string[MAX][LEN]; int i, j, k; for(i=0;i<MAX;i++){ printf("Inf. uma string: ")...
asked by 25.10.2017 / 17:30