Questions tagged as 'c'

2
answers

Find the most frequent character in a text

I did, but I would like printf not to repeat itself ... Is there any way to display only the most common character? #include <stdio.h> #include <stdlib.h> int main() { char string[100]; char letras[] = "abcdefghijklmnop...
asked by 06.06.2018 / 21:33
1
answer

Functions with parameters in C language

I need help solving the following problem: "Write a function that gets an array of integers as a parameter and returns the index of the largest element of the array. I made a part of the code and it does what was requested, but not in the...
asked by 06.11.2017 / 10:11
1
answer

Validate user entered only number - C

I have a declared string as follows: char cpf[12]; I want to validate that the user entered only numbers when he entered ENTER. I captured the value entered by the user like this: gets(cpf); Then I call a function that traverses...
asked by 08.11.2017 / 02:22
2
answers

Accessing variables from a struct

I'm studying C and I'm doubtful about the difference of the following lines: (*depois).agora = 20 and *depois.agora = 20; So I understood the point . has priority and the compiler would try to solve depois.agora and after...
asked by 08.10.2017 / 18:37
1
answer

Why does this infinite loop happen?

I made this code but it is looping infinite and I can not fix it ... #include <stdio.h> int main (){ int x, z; while("x=100; x!=65; x-=5"){ z=x*x; printf("%d --> %d\n", x, z); } }     
asked by 10.10.2017 / 05:17
1
answer

How to use the pow function of C?

The program is not complete yet, but should at least run função1 . The following error is occurring: /tmp/ccbRtCar.o: na função 'funcao1': iniciosimulado02.c:(.text+0x18f): referência indefinida para 'pow' collect2: error: ld returned 1...
asked by 14.10.2017 / 20:44
2
answers

Block letters and special characters

Good afternoon. I'm developing a C program and I have to deal with it when the user types letters or special characters. It turns out that when I try to type a letter, the program will loop, type flashing on the screen. I wanted to know how I ha...
asked by 11.05.2017 / 19:25
1
answer

The old woman's game in C. The program ends before

I'm trying to make a game of the old language in C but in the first move of player 1 depending on where to put the 'X' the program already ends declaring the player one as a winner. Here is my code: #include <stdio.h> #include <string...
asked by 14.06.2017 / 23:15
1
answer

Print pre-defined phrases, randomly in C

Hello, I'm a beginner in programming and am learning to program in C. I want to make a program that has some already defined phrases. Ex with vectors: char vet1[100] = {"Hello World!"}; char vet2[100] = {"segunda frase"}; ... and wit...
asked by 05.06.2017 / 15:25
2
answers

Stack even and stack odd logic error

I have this code below, it works, but it's strange, it does not print the last position. #include <stdio.h> #include <stdlib.h> #define TAM_PILHA 2 #define NUM_ENTRA 5 void empilha(int *pilha, int *topo, int valor) { if (*topo &l...
asked by 14.03.2017 / 12:17