Questions tagged as 'c'

2
answers

Sort a struct

Do you have some way to sort% of the form: struct cidadecoord { char cidade[90]; int coordx, coordy; }cidades[N]; N is worth 30 in the case, and I would like to order the coordinates x and y, to find out which cities were more to the ea...
asked by 30.11.2014 / 19:18
2
answers

How is the logic to print the numbers in ascending order in C

I created a code that takes a certain number of numbers set by the user, and does the separation of odd and even, until I got to do it, my problem is to put the numbers in ascending order so that the code looks more beautiful visually at the tim...
asked by 17.10.2018 / 20:37
2
answers

Error in struct member access passed by reference

I have the code below that has a function to set the salary = 4000, but it returns the following error:    [Error] request for member 'salary' in something not a structure or union The error occurs on the line that I try to set the salary...
asked by 22.06.2014 / 17:07
2
answers

Display the first 5 numbers by 3, discarding the number 0

I can not display the first 5 divisibles by 3, I put a counter variable, but it returns another number. #include <stdio.h> #include <stdlib.h> int main() { int n = 20; for(int i=1; i<=n; i++) { if(i%3 == 0)...
asked by 02.03.2016 / 02:03
2
answers

Rule of For in C

I have a doubt about the for loop, that is, I have a for statement and I have to get the result that the machine gave. I have this: for(x=2,Y=1;X < 11;x++)y+=x++ I know that the variable X starts at 2 and Y at 1. I know that while X is l...
asked by 21.02.2016 / 20:20
1
answer

C print name with scanf

I have the following code, the problem is that it returns string2 as '(null)'. How do I solve it? and why does this happen? #include <stdio.h> int main() { char *string; char *string2; printf("Primeiro nome: "); scanf("%...
asked by 24.09.2014 / 11:39
2
answers

Targeting failure: Image of the recorded core

I made a code in C to find the smallest value and position of it in a vector x [N]. Every time I compile the program through the terminal (Linux), it gives the following message:    Targeting failure (recorded core image) I used the same...
asked by 05.08.2018 / 02:19
1
answer

Counter adding an extra value in vector with pointer

I'm trying to finish an exercise that asks for 4 ages, and the output tells how many of the entered ages are greater than or equal to 18 but the counter always adds a value greater than 18 at the end and I do not understand the why. #include...
asked by 01.07.2018 / 23:42
1
answer

I do not identify the error - | 35 | error: 'd' undeclared (first use in this function) |

I'm programming in C / C ++ and gave an error that I can not identify it. #include <stdio.h> #include <stdlib.h> #include <stdbool.h> //Função Principal do Programa int main() { //Definindo variáveis int a = 5,...
asked by 10.07.2018 / 23:40
1
answer

Difficulty in sorting

I'm doing a program that orders the words, but if they are the same size you can not change places, I'm stuck in that part, the code I already have #include <stdio.h> #include <string.h> void coloca(char nomes[][100], char *frase,...
asked by 03.09.2018 / 23:48