Questions tagged as 'c'

3
answers

What are the differences between printf, fprintf, sprintf, snprintf, printf_s and fprintf_s?

Searching I noticed that there are several variations of printf , but I did not understand the differences and which to use in certain circumstances. I would like to know the purpose of each with their differences and how they can be us...
asked by 04.09.2016 / 05:56
2
answers

How to receive a string and by the switch to check in C?

I have to develop an algorithm that gets the name of a place, for example "School", and based on this, make a check of the string in switch , and if it is "School ", then he sends a message to the user about what to do, for example," Stu...
asked by 28.03.2017 / 00:07
1
answer

How to implement timeout on recv () in socket.h

I'm wondering if there is any function to put a timeout together with recv () using Socket.h . Code sample: // Variaveis UINT in_socket_handler; struct sockaddr_in server; // Cria o Socket in_socket_handler =...
asked by 02.08.2016 / 22:02
2
answers

Invert array (vector) without an external function, 'manually'

Friends, I always inverted vectors using a helper in an external function (I think the default way), but until recently a friend told me that I had a way to invert vectors without using a helper, I asked to show myself but it turned out What did...
asked by 31.05.2016 / 15:05
2
answers

Placing and comparing dominoes in order in C, using list or not (if not)

The program asks you to check if you have the same dominoes (if you have at least one possibility of joining data 12 | 21) and asks to show an order that suits the basic rule of the dominoes (12 | 24 | 45 | 53); An accepted entry would be:...
asked by 05.05.2016 / 21:54
3
answers

Counter of a subsequence of strings repeated in C

Consider a string composed of several subsequences.    For example: cccaaaabbbbxdddddddddaaannn. The smallest substring is the letter x, with only one element; the largest subsequence is that of letter d, with 9 elements. Make an algorith...
asked by 01.11.2018 / 21:18
3
answers

Why is a named vector inside?

I would like to know the function of using a name within a vector? char chave[NUM_LETRAS + 1]; int frequencias[NUM_LETRAS]; int frequencias2[NUM_LETRAS]; char codificado[MAX_STR]; char descrip[MAX_STR];     
asked by 24.04.2018 / 21:55
2
answers

Function returns pointer to garbage, and free locks the terminal

Can anyone explain to me why I give free in pontaux the Windows terminal stops responding? And why when I pontmaior my result comes as memory garbage? The function returns a pointer to the largest value of a vector. Co...
asked by 08.02.2014 / 01:41
2
answers

gets () function for float value

I wanted to use the gets() function for a float value, or a similar function.     
asked by 15.05.2016 / 12:16
3
answers

Doubt regarding pointer

I have a question regarding C. Because when I declare as argument in function main: char* argv[] instead of char argv[] I can access the information. I know one is a pointer. Because I can not access when it is not a pointer. #in...
asked by 11.04.2017 / 17:31