Questions tagged as 'c'

1
answer

How to allocate space in memory? [closed]

Make a program to allocate space in memory for 10 integers and ask the user to enter 10 values. Then print out their memory address and content. What do I have to change in my program so that it works? #include <stdio.h> #include <...
asked by 30.11.2018 / 22:31
1
answer

When to use a scripting language? [closed]

When to use a script language and what is the ideal scenario for using it? I have read about script languages and thought about using them in my C / C ++ server project for one game, which leads me to another question: I know it depends a...
asked by 06.12.2016 / 23:41
4
answers

Error Segmentation Fault (Core Dumped) Binary Tree Search

I'm doing a job that performs a search for a key (an int value) in a binary tree populated from a txt file. The file txt has the following registry in each row: a key (int), a given1 (long int) and a given2 (char [1000]). For example, the fi...
asked by 19.01.2018 / 06:30
1
answer

Problem in the algorithm on percentage

I had to do this algorithm:    In 2010, a small Brazilian city has 20,000 inhabitants. The forecast   of IBGE is that this city grows at a rate of 5% per year. Knowing   addition, make an algorithm that prints on the screen the year and popul...
asked by 30.01.2018 / 00:06
1
answer

Validation of scanf in c

I have a problem that I need to validate an entry to receive only integers, if I do not receive it, I should force the user to type an integer. I can not disregard numbers after the comma (in the case of decimals) and I can not return the entire...
asked by 25.10.2016 / 14:31
1
answer

When copying the code it gives an error using the WHILE function in C

#include <stdio.h> #include <string.h> int main() { int num_key=666; do { puts("\n\n\t*********************************************"); puts("\t* *"); puts("...
asked by 01.04.2017 / 18:05
2
answers

How to turn this C ++ code into C?

#include <bits/stdc++.h> using namespace std; int main() { int n, i, n1, c = 0, c1, c2, max, pos, bar[501], arr[250001], j; cin >> n >> n1; max = pos = 0; for (i = 1; i <= n*n1; i++) { cin >&...
asked by 22.11.2017 / 14:31
4
answers

How to read an input in the loop loop [closed]

I am a beginner in C. I need the program below to read the number entered in the console and give the user tips until he gets it right: #include <stdio.h> int main () { int num; printf("Informe um número entre 0 e 10:\n"); s...
asked by 01.09.2015 / 19:58
1
answer

How to remove negative elements from a row?

Good afternoon guys, I am trying to remove a negative element from a queue, we can put the elements in the queue but when removing the element it always removes the first element ... This is the Teacher's Exercise: Given a row of integers,...
asked by 12.10.2015 / 21:15
1
answer

Go through array 4x4 with for, I did not understand

I did not understand this code: #include <stdio.h> #include <stdlib.h> int main() { int i, j; for(i=1; i<5; i++) { for(j=1; j<5; j++) { if(i==j) printf("1 "); else...
asked by 20.07.2015 / 01:21