Questions tagged as 'c'

1
answer

How to make a process wait for the 'brothers'

Hello. I need to create a process tree, so far what I managed to do was create one side of the tree, kill everything and then create the other side. But I need to create the whole tree before and start killing the children and the father. My...
asked by 29.04.2016 / 22:54
1
answer

Lexicon Analyzer using LEX

I'm using the LEX generator to do a lexical analysis of a simple code in C ++. The following code is from the generator: %{ #include<stdio.h> %} extern FILE *yyin; %% "<" {printf("(Identifier, %s)\n",&yytext[0]);} "&...
asked by 13.07.2016 / 16:56
3
answers

Is there any way in pure C to implement set?

I'm doing a job for college and I need to check word for word from a "dictionary" in file txt and compare those words with the words of an array that was provided. In order to make my life easier (as I'll have to figure out some way to...
asked by 14.12.2015 / 20:44
4
answers

Divide a string with empty spaces

I'm trying to split an entry of the following type: 1444771699,Andre Alves,SAQUE,-500.00,,200 I'm trying to use strtok , but it ignores empty space. Any idea how to split the string without ignoring the space?     
asked by 02.11.2015 / 18:22
1
answer

Dynamic Stack - C

I'm studying dynamic stack from the code below: #include <stdio.h> #include <stdlib.h> #define tam 50 // ---- Estruturas para os tipos ------------------------------------------------------------------------------- typedef struct...
asked by 17.09.2018 / 23:19
3
answers

Is it possible to use for loop to reduce code in C?

I have the following function: A . Is it possible to use the B for loop to generate declarations as in the A function? What to use instead of printf to become a declaration? printf("%s%i%s\n",ad1,i,ad2); A void functionX(unsigned...
asked by 20.06.2017 / 08:58
1
answer

Search Binary and Ordination

There is a more efficient way to do this same function and I do not know why my computer is not working. #include <stdlib.h> #include <stdio.h> void ordena(int A[],int n); int buscaBinaria( int chave, int inicial, int v[]); int...
asked by 26.11.2015 / 01:52
4
answers

What are files with .cpp and .h extension?

What are these files with extensions .cpp and .h ? How do they interact?     
asked by 26.09.2017 / 14:47
2
answers

Behavior of malloc (1) in C

If I use char *char_commandout = (char *) malloc(1); , the allocated byte will store "\ 0" at position 0 of the vector or it will allocate a space for the value that I want to store (at position 0) and one for "\ 0" (in position 1)?     
asked by 19.06.2018 / 04:31
3
answers

Clear C buffer with fflush () or __fpurge ()

Studying strings in C I came across the following phrase: "Cleaning the buffer, for example, is not always desirable, and for more professional and safe programming it is not recommended to use fflush for example." Why using the fflush()...
asked by 04.02.2016 / 15:24