Questions tagged as 'c'

1
answer

What's wrong with my code? It gets giving error "[Error] ld returned 1 exit status"

Get any value and ask the user if this value is in dollars or in reais. If they are dollars, convert them to reais. If they are real, convert them to dollars. Repeat the operation until the sum of the values entered is greater than 10,000. #in...
asked by 09.04.2016 / 04:39
1
answer

Problems in an array of strings in a structure

I'm having a problem about an array of strings that I'm trying to access from a structure. The structure is set to header.h which has the following format: typedef struct { char *produtos[200000]; int contador; } Produtos,*ProdutosP;...
asked by 12.03.2016 / 17:02
1
answer

Vector ordering of character vectors with qsort stdlib.h

The next program is not ordering the chars vector vector correctly, but I do not know why. Maybe it's my helper function "cmpstr" that is not returning the right value in some cases, or my qsort call ... What's wrong? #include <stdio.h>...
asked by 16.06.2016 / 06:54
1
answer

Infinite loop when passing through memory addresses

I was making this code whose purpose is to use pointers to fill an array with an arithmetic progression. However, I can not get out of the first loop. int main() { int r, // Razão da PA i, // Contadora pa[10], // Array que será pr...
asked by 19.03.2016 / 16:26
1
answer

C logic doubts [closed]

I'm solving a small exercise in C that should print the predecessor and successor of a number on screen. The predecessor prints correctly, but the successor always shows 108. regardless of the number entered. I guess it's kind of crap. How do I...
asked by 20.03.2016 / 13:11
2
answers

Store values of a string in a vector

I need to make a program in C that takes a sequence of numbers, stores the values in a vector, and then prints that sequence in reverse order. It must receive two entries, the first is an integer that indicates how many numbers the sequence has,...
asked by 29.02.2016 / 17:06
1
answer

Error in file code. W

I need to do a simple search engine. Just open arquivo.txt , search for a word desired by the user, check how many times a word appears in the file and whether it exists in the file. But this is giving an error that I did not identify the...
asked by 18.02.2016 / 02:07
1
answer

Cast struct c / c ++

I'm looking at a network sniffer code and I do not understand the following lines: ethernet = (struct sniff_ethernet*)(packet); ip = (struct sniff_ip*)(packet + SIZE_ETHERNET); How do these cast with struct work? /////////////////////////...
asked by 26.10.2015 / 20:47
1
answer

System date storage

I need to capture the system date and store it in an integer variable, as I'll have to compare it with a date that the user will be informed. I found the _strdate function that stores the date in the DD / MM / AA format in a string, howev...
asked by 08.10.2015 / 02:37
2
answers

Application of Bubble Sort

I am making a program, which prints the numbers entered by the user in ascending order using Bubble Sort. I wanted help to implement this function. My code: #include <stdio.h> #define MAX 10 int main() { int vetor[MAX], i,t,a;...
asked by 07.10.2015 / 05:47