Questions tagged as 'c'

2
answers

How to show the largest number entered using functions?

#include <iostream> using namespace std; void maior(int a, int b); int main() { int cont, maior1; do { cout << "digite um valor: "; cin >> cont; maior(maior1,cont); }while (cont != -1);...
asked by 01.11.2015 / 15:10
1
answer

Using the pthread library in windows environment

Is it possible to work with the pthread library normally in a windows environment? Or should it just be in linux?     
asked by 04.09.2015 / 03:18
2
answers

How to replace 1 bit of an integer without changing the other neighboring bits?

I want to change 1 bit and keep the same values as other neighboring bits. The bit operator shifts left or right by changing the 1-bit 0 bit, but it changes the entire 8-bit sequence. I did not want that to happen. Alternatively, I change...
asked by 18.06.2017 / 20:57
2
answers

Error creating child - Scheduling processes using fork

Write a C / C ++ program called novela.cpp that does the following: The Parent process creates a Son1 process in 10 seconds and a Son2 process in 20 seconds and then runs indefinitely. Well, I developed the code, he creates the father, he...
asked by 22.06.2017 / 01:51
1
answer

Problem in language C, question with prime numbers

I'm solving exercises, in C language, on vectors. The exercise is as follows: Make an algorithm that uses a menu with the following options: order a vector of 5 increasing positions, order a vector of 5 decreasing positions and store in a vector...
asked by 01.08.2016 / 00:32
2
answers

Passing by reference in C

In the case of C language, when we want to pass a variable by reference we need to pass the address of the function to the function, I have a question in this case. See the example: int main(){ int *a; *a = 5; foo(&a); } void...
asked by 03.07.2015 / 19:12
1
answer

Sequential Static List

Galera look at this code: lista is struct lista * crialista() { lista *li; li = (lista *) malloc(sizeof(struct lista)); if(li !=NULL) { li->qtd = 0 ; } } Why was lista allocated to...
asked by 07.07.2015 / 15:44
3
answers

How to run a C program in Visual Studio Code

I'm trying to run a code (program) in C in Visual Studio Code, but I can not find the necessary settings. I installed the C / C ++ (Microsoft) extension Project structure: .vscode          - c_cpp_properties.json          - tasks....
asked by 25.10.2016 / 14:47
2
answers

Error displaying the sum of three read arrays

#include <stdio.h> #include <stdlib.h> int main() { int i, notas[5]; int soma = 0; for(i=0; i<3; i++) { printf("Digite os tres numeros:\n"); scanf("%d", &notas[i]); } for(i=0; i<3; i++) {...
asked by 18.05.2015 / 22:49
1
answer

Program does not read file data correctly

I have these three structs: typedef struct { char codigopaciente[10]; char nome[50]; char telefone[50]; int idade; char sexo; } paciente; typedef struct { char codigomedico[10]; char nome[50]; ch...
asked by 01.12.2014 / 22:45