Questions tagged as 'c'

1
answer

Search a node data in a list

I am trying to find a data from my linked list, in which I scroll it until it is null and say if that number to look for or not in the list Code: aux=primero; while(aux != NULL && aux->dato != 50) { aux=aux->siguiente; }...
asked by 08.08.2017 / 22:24
1
answer

Insert second node in front of the first

I have a small code where I want to insert a node at the beginning of the list, but it is placed after the first node I already have: For example pointer first points to NULL, the list is empty, I insert the first node with value 5, So all right...
asked by 08.08.2017 / 18:59
1
answer

Error in list linked in C

I'm making a list linked in C of integer data that is saved in it until you press Enter. The problem is that the last element that saves is garbage, because it keeps a dynamic memory address and still can not find the error. Here is my code:...
asked by 14.06.2017 / 04:30
1
answer

How to prevent me from printing garbage from an array?

My program read a text from a .txt and saves it in the text [TAMTEXTO] character by character, then in the separatewords () function; I separate the words with a if condition, if you find a space save the word in a two-dimensional arrangem...
asked by 27.06.2017 / 05:06
1
answer

Delete line break when using fgets in c

when reading a string of characters with fgets, this also saves the line break (\ n), how can I delete that line break using fgets anyway to read? It does not help me to use fscanf or another format to read Thanks.     
asked by 20.06.2017 / 00:27
1
answer

how to solve that doubt to save names and ages

My question is how can I read names and ages in a vector or matrix. I only carry this #incude<stdio.h> int main (){ char f[15],c[15]; int b[20];     
asked by 13.06.2017 / 03:13
1
answer

How can I remove a contact from a binary file in c

I try to delete a contact but regardless of the line that I indicated to delete only delete the line 0 void borrarContacto () { int l, linea, NUMlineas=0; char LINEA[MAX],c, ch; FILE *destino, *a; printf ("\nTu lista de conta...
asked by 10.05.2017 / 06:16
1
answer

Problem in pointers

I have to make a program that asks for a phrase and from there I printed the phrase and the number of consonants it has and what I did was this, but apparently I have an error reading the string and printing the number of consonants #include&l...
asked by 13.05.2017 / 17:11
1
answer

How to synchronize C threads with OpenMP

I have this code that tries to make a Geometric Series using OpenMP, but in the end it does not get the same result as when it is executed sequentially. #include <omp.h> #include <stdio.h> #define LIM 1000000000 int main(void) {...
asked by 04.05.2017 / 06:10
1
answer

I have this error with lists in c "[Error] request for member 'next' in something not a structure or union"

When trying to compile gives me the error [Error] request for member 'siguiente' in something not a structure or union and I do not understand why. This is the code: typedef struct nodo{ int dato; struct Nodo *siguiente; }Nodo; ty...
asked by 25.04.2017 / 22:46