Questions tagged as 'c++'

3
answers

C ++ - What's the difference between using fixed types of C ++ and typedef of a type?

A few days ago studying emulation I came across a stack overflow question in English on the emulation of CHIP8, and one of the responses told me not to use C arrays such as int i[12] instead of using std::array to be a fixed type,...
asked by 12.11.2018 / 12:03
1
answer

What is the difference between "calloc ()" and "malloc ()"?

What does the calloc() function do that malloc() does not? Why is it barely used?     
asked by 23.01.2017 / 11:35
1
answer

What is the ":" (two points) used for in the declaration of a member of a structure?

I saw this: typedef struct { unsigned char a : 1; unsigned char b : 7; } Tipo; What does this statement mean? What is this 1 and 7?     
asked by 20.01.2017 / 13:24
1
answer

Why can not you declare a variable within a case?

Why does not this compile? #include <stdio.h> int main(void) { int valor = 0; scanf("%d", &valor); switch (valor) { case 0: int variavel = 1; printf("%d", variavel); break; default:...
asked by 09.01.2017 / 16:02
8
answers

How to raise a number to a power without using the math.h library?

How can I raise a number to a power without using the math.h library? Example: potencia = x ^ 1/2; How do I do this in C ++?     
asked by 11.02.2014 / 16:03
2
answers

What is the difference between "NULL", "\ 0" and 0?

Both are worth zero. Can I always use the 3 interchangeably?     
asked by 16.01.2017 / 11:51
1
answer

Difficulties with selecting items in a QTreeView

Scenario: I have an application that manages a list of images of human faces with prototypical emotional expressions. I've created a class inherited from QAbstractListModel to provide the data access model (model), and I'm using two...
asked by 04.03.2015 / 04:35
2
answers

What is Iterator?

Studying STL in C ++, I almost always encounter the term iterator , example: std::vector<int>::iterator it; What is the function of a iterator ?     
asked by 08.11.2016 / 19:44
2
answers

How to create a file.h?

What is a arquivo.h and what improvement does it bring to the C ++ program?     
asked by 27.07.2015 / 03:36
2
answers

What is the best alternative: define, enums or variables?

Recently, in a project where I have to declare many contributors, I had this doubt. What is the best option define's , enum's or constant variables? At first I think using enum is the best alternative for not polluting the...
asked by 06.03.2014 / 15:57