Questions tagged as 'c'

1
answer

How to return or extract more than one value from a function?

integerPower( int y ){ int base2; int base3; int base4; int total; base2 = pow( y , 2); base3 = pow( y, 3); base4 = pow( y, 4); When I call this function (I did not type return because that's the question) I...
asked by 13.12.2016 / 00:44
0
answers

How can I make a switch run in parallel with another switch?

I made this code to move a character to a college job, but I wish that when I pressed the 'a', I could still walk and the ship would not be erased, just as I could press the 'a' several times and I got a lot of shots, I took a look at the pthrea...
asked by 11.07.2018 / 16:07
1
answer

Create a file in another C directory

I have a folder containing my .c file, its executable, and another folder called Files. I need when the function below is executed the file is created in the Files folder and not in the folder where the .c and .exe are found. char nomeDoArquiv...
asked by 09.07.2018 / 16:28
0
answers

How to extract a word between, e =?

Assuming I have a word: char[1000]={"ALGUMA COISA,ALGO=TESTE,FIM"}; The word before = and itself = are optional in the sentence; How do I store the word SOMETHING in a variable? The code below is what I tried, but it is not wo...
asked by 08.07.2018 / 16:47
1
answer

Where is the LITTLE_ENDIAN_HOST macro defined and how does it behave?

After finally understanding how to decode opcodes with a project of a CHIP-8 emulator I decided to go back to an old project of mine, a Gameboy emulator, so I started to implement the CPU and its registers, gameboy is similar to the 8080 and z80...
asked by 04.07.2018 / 13:06
0
answers

Linked list only inserts only one element

I am making a static linked list, that numbers will be sorted when the user types, but when I have insert more than one element it appears that the list is full, I do not know why this is happening My code #include <stdio.h> #include...
asked by 02.07.2018 / 02:32
1
answer

Pointers with argc and argv

I have the following code to run on the terminal. It checks if the first argument is a '+' and then adds the next numbers. int main(int argc, char *argv[]) { int i, soma; char oper; oper = *argv[1]; soma = 0; if(oper == '+'){ for(i = 2...
asked by 29.06.2018 / 22:10
0
answers

Error Returning Two-D Matrix in C

Next, I have a ReadData function, which receives all information from a txt file, after that I use the BreakStringComplete function to separate this string by the delimiter "\ n" inside the function, through printf I can see that the lines were...
asked by 27.06.2018 / 01:59
0
answers

How to return a dynamically allocated two-dimensional array?

In a generic formulation, I have a function that places a value in an array of strings; just as an example: char **matrizExemplo() { char **vet; char tamVetor = 1; vet = malloc(sizeof(char*)*tamVetor); vet[0] = malloc(sizeof(c...
asked by 26.06.2018 / 17:29
0
answers

Processes in linux (fork ())

I am creating a client / server type server using tcp sockets , a client connects to the server, closes the client application, / strong>, but the process on the server that opened that port is still connected to that port, even after the close...
asked by 29.06.2018 / 03:07