Questions tagged as 'c'

1
answer

Calculate how long a car has been parked

I'm reading a parque.txt file that contains the hours a car was in a parking lot, type "9h00 10h30" , this on each line. I was trying to get these times in each char block, in which case I would have hora_i="9", min_i="00",...
asked by 15.06.2014 / 02:11
1
answer

How are the functions of the standard libraries of different programming languages implemented?

How are standard libraries of different programming languages implemented? For example, stdlib.h , or Java.Swing , how the System.out.prinln() function is implemented for example.     
asked by 08.07.2014 / 09:30
1
answer

Why is strcpy () unsafe?

I'm reading about secure programming, and I read that the strcpy() function of the C language is an example of insecure function. I also read that there is a safe version of this function, which would be strcpy_s() . What is...
asked by 30.04.2016 / 21:57
1
answer

Reduce a string in C language

How do I reduce the size of a string in C? In my program it is implemented as follows: char nomeString[] = "nomedoarquivo.txt"; I want to cut the ".txt" from the end of the string .     
asked by 27.11.2016 / 17:42
1
answer

Is it interesting to create a type just for a pointer to a type?

I've seen it doing a MinhaEstrutura * be explicitly typed as typedef MinhaEstrutura * pMinhaEstrutura; Why not always do this and get rid of having to rename?     
asked by 12.01.2017 / 11:16
1
answer

Difference between fflush and setbuf

What is the difference between the functions fflush(stdin); and ** setbuf(stdin, NULL);** ? When to use and when not to use each?     
asked by 12.11.2016 / 15:33
1
answer

How to create program in C that can use parameters?

I'm studying C, and now trying to pass parameters. Well, although I'm thinking I got it, it's giving me an error when I try to use that variable ... I need to compare the "argument_value" char to make decisions in the program! What...
asked by 04.10.2016 / 04:26
1
answer

Tree strictly binary

   A binary search tree is strictly binary if all nodes in the tree have 2 children or none. Implement a function that checks whether a binary search tree is strictly binary. // Estrutura de dados typedef struct { int chave; }tipo_element...
asked by 15.01.2018 / 16:22
2
answers

How to free memory from an internal malloc to a function that returns a pointer?

How to release an inner% of% to a function that returns a pointer? In a simple way to try to exemplify my doubt, consider the following malloc function: int *f(int tam) { int *ptr = malloc(tam * sizeof *ptr); return ptr; } I...
asked by 22.02.2015 / 21:08
2
answers

Assign a value to the pointer and multiply (directly)

How do I multiply the pointer as soon as I assume a value to it? #include <stdlib.h> #include <stdio.h> int main (void) { int a,*b,*c,*d; printf ("\nInforme um valor: "); scanf ("%i",&a); b = &a; // Co...
asked by 29.06.2016 / 02:23