Questions tagged as 'c'

1
answer

Question: Dynamic list chained inside another, in C

I'm having a hard time getting a dynamically linked list inside another using data structure and manipulating it, as I have not found anything that exemplifies how to create a list within another. I can create a single dynamic list, but I can no...
asked by 04.05.2015 / 04:18
2
answers

Execute bash commands in C

I am using the system("comando"); function to execute bash commands in a program in C. However, I'm having trouble printing the value of a variable. #include <stdio.h> #include <stdlib.h> int main(void) { char* letr...
asked by 04.07.2018 / 03:27
3
answers

How to get the buffer from the socket?

I am receiving a quantity of data coming from a server, the client (the code below), after sending a message, it receives another one, but would like to know the size of the message that is coming from the server to allocate the variable before...
asked by 23.03.2017 / 01:56
3
answers

Conversion of variables type int to type char *. C ++ [duplicate]

I have the following method that gets two int variables as a parameter and I need to concatenate these two values into a char * variable, but for this to be possible it is necessary for these two int variables to be converted to char *. void...
asked by 28.07.2016 / 20:54
3
answers

Isolate processor to run only my program

How can I isolate the processor to run only my program in C? It is more a didactic and academic question passed by my teacher of AI. He asked us to run millions of real-number sum operations, and take the time the processor took to run the...
asked by 14.09.2017 / 02:19
2
answers

C printf error

The error in question in a flag that should supposedly be correct, follow the code below: #include <stdio.h> #include <string.h> int main() { char var[50]=" Write Once Bug Everywere "; int i,cont=0; for (i = 0; i < 50; i++...
asked by 18.02.2017 / 01:22
2
answers

How does optimization -O3 break some programs?

When compiling my own programs, I have the freedom to change some flags of the compiler and start using the -O3 optimization. This optimization can break some programs. I understand that the compiler should do and assume several...
asked by 20.02.2017 / 12:40
1
answer

This code is O (n)?

#include <stdlib.h> #include <time.h> int maior(int n, int A[]){ if(n==1) return A[0]; if(maior(n-1, A)<A[n-1]) return A[n-1]; else return maior(n-1,A); } int main(){ int n, i; printf("Ta...
asked by 10.01.2018 / 16:47
4
answers

How to convert a char to an integer?

Converting a string to an integer with the atoi() function is easy, is not it? However, when I use the atoi() function to convert a character to an integer, the program that is at runtime simply crashes. What would be...
asked by 01.04.2018 / 23:53
2
answers

Is it possible to connect an application made in C to some database?

We usually use files to save data using C language (I at least). Is it possible to connect a relational database to some application made in C ? If so, do you need any library for this and how is that connection made? Preferably MySQL.     
asked by 21.09.2016 / 19:42