Questions tagged as 'cast'

1
answer

Cast of char vector for pointer

How does a cast work in a char vector for a int pointer? for example: char vetor[2]; int *p; p = (int *)&vetor; Can anyone explain this line to me?     
asked by 24.06.2015 / 03:25
3
answers

How to change a text variable to number value?

I have this segment of code, I would like someone to help me in transforming the variable P (in which it takes the attribute 'value') and transform it into number value for the sum. $(document).ready(function(e) { $('.pizzad...
asked by 03.12.2016 / 01:41
2
answers

Do (Cast) the return of Malloc (), Calloc () and Realloc () - C

According to the discussion Do I cast the result of malloc? , in C it is not recommended or correct to do the cast of the return of Malloc (). Does this also apply to the Calloc () and Realloc () functions? Taking advantage, is the correct ta...
asked by 31.12.2018 / 14:57
1
answer

What are the differences between the following casts and when to use each one?

   Casting   [...] process where one type of object is explicitly converted to another type, if conversion is allowed. Source: > Stack overflow in Portuguese Assuming the following situation: var i = 10 What are the di...
asked by 09.09.2016 / 00:51
2
answers

Functions of cast or direct cast. What is the best option?

In PHP, I realize that it is possible to do some things in a number of ways. One of those that comes to my attention is the functions and functionalities related to type conversion. You can use both the type keyword and use functions. For...
asked by 18.08.2016 / 16:19
1
answer

Type Object in PHP

I'm practicing some code in PHP when I come across this: <?php $a = (object) ["a" => "b"]; $b = (object) ["a" => "c"]; $y = $a <=> $b; echo $y; $v=[1,2,3] <=> [1,2,3]; echo $v; $a= (object) ["a" => "b"]; $b = (object)...
asked by 14.11.2018 / 22:26
1
answer

What's the difference between Cast and Convert?

In a Transact-SQL book (Ramalho Series) it is said: CAST AND CONVERT    Implicitly converts one expression from data types to another.   CAST is a synonym for CONVERT. What do you mean by CAST is synonymous with CONVERT? What is the us...
asked by 21.06.2017 / 13:58
2
answers

How to convert scientific notation to string with full number

What php function should I use to do this type of conversion?    Converter: 1.3388383658903E + 18 for: 1338838365890273563 I tried this, but it did not work: echo sprintf(sprintf('%%.%df', 0), '1.3388383658903E+18'); And that too:...
asked by 04.10.2016 / 19:26
2
answers

What is the purpose of unset as cast in PHP?

As of PHP 5, there is a way to cast a cast to convert a given value to NULL . Example: $teste = 'teste'; var_dump((unset)$teste); // NULL $outroTeste = (unset) funcao(); var_dump($outroTeste); // NULL I can understand that un...
asked by 12.12.2014 / 02:50
1
answer

How to convert date to datetime?

I have the following case, I'm trying to convert a date field to datetime using update update tb_RHContratos set DtCadastro = cast(DtCadastro as datetime) But some of the date does not format correctly as they are too many r...
asked by 06.11.2015 / 19:20