Questions tagged as 'c'

1
answer

Problem with scanf

Hello, I'm trying to make a customer registry in C using struct and I came across the following problem: When you read the user's DDD with scanf it did not write, not even print the value, just the location of the variable I was a...
asked by 04.12.2017 / 16:54
1
answer

Ordination by name and enrollment

I have this list simply chained and I do not know how to order it. I need to sort by name and enrollment. #include <stdio.h> #include <stdlib.h> void BuscarMatricula(); void Inserir(); void Exibir(); void Remover(); int menu(); vo...
asked by 04.11.2017 / 03:16
1
answer

C code shows error "Targeting failed (recorded core image)" error

The code compiles and runs normally up to the "switch" statement. #include <stdio.h> int main(){ float mg, sp, rj, ms, produto; int escolha; printf("Digite o preço do produto: "); scanf("%f", &produto); // Impo...
asked by 16.10.2017 / 19:13
2
answers

Size of a dynamic array

I'm doing dynamic memory allocation testing, but when I try to get the size of the array I always have the same result. int main() { int *teste=malloc(sizeof(int) * 10); int len=sizeof(teste) / sizeof(int); print("%i\n", len);...
asked by 06.10.2017 / 21:51
1
answer

Why does the variable x of double always print the same value WRONG in scientific notation?

In this first example I would like to know why the variable x handles double, when it is formatted by the function "printf ()" does not display the value correctly, and every time the value is the same. #include <stdio.h> int main(){...
asked by 11.10.2017 / 00:53
1
answer

Problem to enter Switch

Good afternoon, when executing the program below, after typing the third note, the program ends without typing the letter required to enter the switch. I tested with "i" getting integer and the program worked. Thank you. float media_aritmet...
asked by 19.11.2017 / 16:39
1
answer

Work in C "Bank" giving error

Hello, I am doing a work in c and are giving the following error: after I make the deposit / withdraw instead of returning to the menu the program asks to retype. main(){ int matriz[5][2],i, j,b,dep,v,a,x,saq,sald; printf ("\nBEM VINDO AO...
asked by 08.11.2017 / 09:22
2
answers

How can I print a string instead of char?

In the following code I have a char with 2 characters, H ( Heads ) and T ( Tails ), at the time of printing it will clearly print one of these 2 letters but I wanted to make a change and print "Face" or "Crown". How wou...
asked by 07.11.2017 / 09:24
1
answer

Generate all possible paths

In an exercise, I need to print in a file all the possibilities of trajectory between a number% of cities%, with each city being represented by N and x coordinates and that the last city must be the first (All cities should be test...
asked by 15.09.2017 / 21:52
1
answer

Reference error in winsock2

I am trying to create a socket in c with windows api winsock2.h but when trying to compile my code it returns me the following error    undefined referrence to WSAStartup       undefined referrence to WSAGetLast       Error: ld returned 1 e...
asked by 18.09.2017 / 00:40