Questions tagged as 'cast'

1
answer

How to interpret this line? (struct list *) 0)

while (variavel != (struct lista*)0) { ... } How to interpret (struct lista*)0) ? What does that mean?     
asked by 18.09.2018 / 22:15
2
answers

Binary cast is available in PHP?

PHP has a cast (which until then I did not know), called binary . Example of Manual : $binary = (binary)$string; $binary = b"binary string"; According to the PHP Manual:    (binary) - convert to binary string I saw t...
asked by 27.01.2015 / 12:13
1
answer

Difference between cast of structures

struct a{ int a; int b; }; struct b{ int a; int b; } int main() { struct a *p; struct b b; p = (struct a *)b; // deste modo da erro p = (struct a *)&b; ; deste modo o compilador não aponta erro; } Would you li...
asked by 31.01.2016 / 22:09
1
answer

Why does this work? pointer = (struct a *) & b;

struct a { int a; int b; }; struct b { int a; int b; }; struct a *ponteiroa; struct b b; b.b = 20; ponteiroa = &b; //Isto não dá certo ponteiroa = (struct a *)&b; Why does this (struct a *)&b work? Why c...
asked by 19.09.2018 / 23:59
2
answers

ClassCastException error trying to cast between classes

I'm having trouble casting a class in a class, when I use the inherited class method it gives the following error:    "entity.Aula can not be cast to tableview.AulaTV" Here is the exception described above. AulaTV atv = (AulaTV) new Aul...
asked by 26.10.2016 / 13:14
1
answer

Difference in casting in Java

What's the difference between the 2 codes below? 1st int x = 10; float i = (float) x; 2nd int x = 10; float i = Float.parseFloat(x);     
asked by 26.01.2018 / 16:48
1
answer

ArrayList: Is this right or does it have a better way to do it?

I know a little bit of java, but now I'm venturing into C #, but here's a question: In Java we instantiate an ArrayList like this: ArrayList<Tipo> nomeArray = new ArrayList<>(); We retrieved a value like this: nomeArray.get(1)...
asked by 30.09.2017 / 16:52
1
answer

Assigning / Printing values to void * in a structure

#include <stdio.h> typedef struct elem{ void * d; }Elem; main(){ Elem *p; Elem e; double pi = 3.14; e.d = &pi; p->d = &pi; printf("%f\n",p->d); printf("%f\n",e.d); } When I do the...
asked by 28.01.2016 / 20:40
1
answer

How to transform a cv :: Mat into ipcMatrixipcRGB?

Does anyone know if there is an easy way to turn a cv::Mat into ipcMatrix<ipcRGB> ?     
asked by 25.11.2014 / 21:25
1
answer

How to do casting between base and derived classes?

I have an exercise that says I have to create a foundation. This basis has two derivatives. I have to do a cast of the derived class (1) for the derived class (2) and the derived class (2) for the base class. How should I do an exercise like thi...
asked by 02.03.2014 / 14:39