Questions tagged as 'ponteiro'

2
answers

Actual difference between operator point (.) and operator arrow (-) in C?

What is the real difference between the two operators. I know that the (->) operator is used when the variable is a pointer, and that it is equal to (*ptr).membro . Well, if I declare a pointer of the type of a structure, I mu...
asked by 19.02.2015 / 03:29
2
answers

How do C hands work?

1st What is the difference between declaring: char* s and char *s ? 2nd Is it always necessary to use the malloc function whenever declaring a pointer ? Example: char* s = malloc(sizeof(char)); //ou apenas.....
asked by 30.12.2015 / 20:34
2
answers

What are pointers?

I've come across this in several languages, especially C and C ++, but I've never understood what it is, how it's used, and why it exists. I discovered unintentionally that it also exists in C # and is an unsecured practice. What are pointer...
asked by 03.01.2018 / 21:47
2
answers

char [] or * char malloc?

What difference in C between char text[10] or char *char = (char *)malloc(10*sizeof(char)); What advantage of using malloc on a pointer?     
asked by 21.07.2016 / 20:10
2
answers

Why assign NULL on a pointer after a free?

I see in many codes assigning NULL to a pointer just after a free , type: free(p); p = NULL; What would be the advantage of this?     
asked by 05.06.2018 / 15:10
2
answers

How do I access a specific RAM location by address?

I'm starting to study pointers in C / C ++ and it was something that drew my attention to the robustness and range of possibilities. However, I can only access memory locations by assigning my pointer an address of an already allocated variable,...
asked by 13.03.2014 / 18:07
3
answers

format '% d' expects argument of type 'int', but argument 2 has type 'char *' - What is this? How to pack?

Code: #include <stdio.h> int main(void) { char caractere, *caractere_ptr = &caractere; printf("Caractere: foi alocado %zu byte\n", sizeof(caractere)); printf("Endereço: %d", caractere_ptr); return 0...
asked by 23.01.2017 / 19:09
1
answer

Variable pointer is declared null, but member function normally executes

Below is an example of the code I'm trying to execute. //main.cpp #include <iostream> using namespace std; class A{ public: A(){} ~A(){} void teste(){ cout << "Teste" << endl; } }; int main(){...
asked by 28.09.2014 / 14:17
3
answers

Error Segmentation fault (core dumped)

I'm getting the following error message in my code:    Segmentation fault (core dumped) Another thing is that when I performed the same operation as preenche on main , using ficha.name instead of dados , the syst...
asked by 01.03.2015 / 23:59
1
answer

Why do we use parentheses in a pointer declaration?

What's the difference between these two statements? int* array1[10]; int (*array2)[10]; Why are there parentheses in the second?     
asked by 10.01.2017 / 11:36