Questions tagged as 'c'

2
answers

Simple declaration of a variable for scanf

I already know how to declare a variable in the traditional way using scanf() , but I'm thinking in a way that I can use fewer rows and make the code more organized (this is what I tried with the variable valor ). / p> It turns out...
asked by 15.09.2017 / 02:58
1
answer

How to create a function that merges elements from two double-chained circular lists

Well, I would like a hint of how I create the function that gets list1 and list2 and returns a third list with the interleaved elements of list 1 and 2, what would be the logic? my code is like this ... #include <stdio.h> #include <st...
asked by 02.08.2017 / 06:38
1
answer

Error declaring an array

I made an array [day] [time], but I get an error initializing it. I get this error and I do not know how to fix it    error : attribute The code looks like this: struct horario{ char M[8][40] = {{"X 8 9 10 11 12 13 14 15 16 17...
asked by 23.07.2017 / 18:54
1
answer

How to make a clock / how to run in the background?

I am making a code that runs a clock so that it shows when the time of use of a machine (informed by the user) expires. In the code the clock stays within a while (1), that way it does not have the user to inform the time of use of the machine....
asked by 24.07.2017 / 18:39
1
answer

Reading odd-numbered records only

Initially, I had to create a program to save the data of a struct to a file. The struct is as follows: typedef struct { char nome[30]; int matricula; char conceito; } TipoAluno; I made the program in a way that saved the data in...
asked by 22.08.2017 / 16:20
1
answer

Error reading file

I need to create functions that read from an input file.txt: Number of points Coordinates of the points Number of lines Number of vertices of each line Coordinates of each vertex of the line Number of polygons Number of ver...
asked by 01.07.2017 / 02:30
1
answer

Counts nodes in binary trees

Good evening, I'm studying binary trees and I came across an exercise that asks us to count the knots. I imitated adapting an algorithm that calculates height and worked out ... int conta_nos (arvore *r) { if (r == NULL) return 0; els...
asked by 28.06.2017 / 02:42
1
answer

Passing by reference, and saving data from a file to a vector

I'm having trouble saving the read data from a text file and a vector from a structure I created. My goal is to open a text file, grab the data that is saved in it, and save it to a vector of type INFO. My program compiles perfectly, but when...
asked by 20.08.2017 / 06:13
1
answer

Doubt pointers in C

I have a whole number n that I want to break (separate your digits) and store in a vector, however my code does not work ... what am I missing? #define TRUE 1 #define FALSE 0 #define DIM1 3 #define DIM2 3 #include<string.h> #inclu...
asked by 19.08.2017 / 20:19
1
answer

Can not be used as a function?

I'm creating a program that sorts some numbers of a vector, and then is a bubble sort. I'm using a function called trocar to change place numbers when one is larger than the other, but the compiler indicates that I can not use this functi...
asked by 19.06.2017 / 02:02