Questions tagged as 'c'

2
answers

How to test if a string is a number in the C language?

I'm a beginner in programming. I am performing an exercise in which I must determine whether a string is a number, whereas the user can write anything as input. Then I created the function below. I can only use the standard library. I'm tryin...
asked by 02.05.2017 / 11:52
1
answer

How to calculate the distance between two points and calculate distance ABC, CAB, BAC? in C

I created in the classroom that program that calculates the distance between two points and then gives the option of 3 different paths: ABC, BAC or CAB. I would like tips to optimize my code, ideas on how to improve it and also tips on new fe...
asked by 30.04.2017 / 17:58
1
answer

reversing a long sequence in c

I need to invert a sequence of numbers, for example, if I insert 1234, I print 4321. The code is working, but for entries of type 0123 or 1230 the zero is simply "deleted", but I needed zero was also displayed on the screen. I could not think or...
asked by 26.04.2017 / 20:13
1
answer

Error in returning a char

I'm wanting to make a program that converts a decimal number to binary. Doing this conversion, I wanted to store the decimal numbers in char . In the function it is stored right, but when I call the function in main , it is giving pr...
asked by 11.04.2017 / 18:17
2
answers

Insert linked list node

I have this function to insert in the beginning, but I am not able to test it. Following: void inserir_inicio (tipo_lista * p, tipo_lista * novo_no) { novo_no -> prox = p; p = novo_no; } I want to identify the error of this function....
asked by 25.04.2017 / 14:16
1
answer

Function First element Stack

How do I make a function return the first element of a stack ? For example: I add integer values in my vector size 5 stack. 3 4 5 6 7 You have to return the first element inserted in the stack, in this case the 3rd. I made this...
asked by 29.03.2017 / 20:41
1
answer

Entry in if () but instructions are not executed

I am trying to make a chat using pipes (chat between server and client). I made an exit condition, in case the server wants to quit / disconnect the chat it writes "quit", in the client in the same way. Doing "quit" from the server is working, h...
asked by 27.05.2017 / 22:25
1
answer

User and password validation in C

I'm making a game that needs authentication to play. How do I validate user and password saved in a .txt file? The code I've developed so far is this: void login(){ int escolhe_dificuldade(); // função para selecionar dificuldade do jogo...
asked by 27.05.2017 / 16:30
1
answer

I can not compare char []

I'm running a server that I've done in C and it's working normally, with one exception: I can not create a condition for received bytes. The Write and Recv functions work normally but I'm falling into a silly error in which the Else clause is al...
asked by 23.03.2017 / 00:25
1
answer

Problem with Segmention fault

I was studying a little, I'm very good at programming, and I came across an error, segmention default , I'll leave my code below, and if possible, someone can figure out why I'm getting this error. p> NOTE: The error comes after typing t...
asked by 23.04.2017 / 15:52