Most voted "int" questions
A data type used to represent integers.
Learn more…114 questions
Sort by count of
-
22
votes1
answer1099
viewsWhat is the difference between Integer.valueOf() when using String or int parameters?
Why in the lines below the results of System.out are different? Integer teste = Integer.valueOf("0422"); Resultado: 422 Integer teste = Integer.valueOf(0422); Resultado: 274 If step one int it…
-
20
votes4
answers6387
views -
16
votes2
answers1211
viewsWhat is the difference between using (int)variable or Convert.Toint32(variable)?
What is the difference between them? At what times is it more appropriate to use one or the other? Examples: string palavra = "10"; var numero = Convert.ToInt32(palavra); // ou (int)palavra ? string…
-
15
votes3
answers8488
viewsWhat happens in a conversion from a char to an int?
How it works when you take a variable and do char-48 To transform in integer, as for example in this code I made, I used a date for example "22/05/1994" stored in a char vector and transformed in…
-
15
votes1
answer10089
viewsDifference between Integer.valueOf(String) and Integer.parseint(String)
I need to convert a String in int, and I came across these two options, which have an equal result. Is there any difference between them? Is there any rule/convention that says which to use or is…
-
14
votes2
answers2102
viewsint and Integer - Java
I’m developing a project in Java and he’s in error, I’ve found it but I don’t understand it. public class Time{ private String nome; private ArrayList<Jogador> jogadores; private Integer gols;…
-
14
votes1
answer335
viewsWhy don’t we have a 128-bit Integer?
We have 16, 32 and 64 bit integer values. short, int and long, respectively. But why don’t we have 128 integers? Or 256 integers? I ask this in case we need to keep an extremely large number that…
-
11
votes1
answer259
viewsHow to remove the last number from an integer?
How can I remove the last number from an integer? Ex: int value = 123456789; int newValue = 12345678; Note that the new value does not have 9. I know it would be possible to switch to a string and…
-
9
votes4
answers48238
viewsHow to convert a String to Int in Javascript?
HTML5: <!DOCTYPE html> <html> <head> <title>JSTest</title> <meta charset="UTF-8"> <script src="JSource.js"></script> </head> <body>…
-
9
votes2
answers643
viewsHow does the int function handle the n character?
I created a list: usuarios = ['123\n','123\n4'] I tried to turn the index 0 into integer using the int() int(usuarios[0]) Upshot: 123 But when I tried to do the same with index 1: int(usuarios[1])…
-
8
votes2
answers9026
viewsAlgorithm in C to convert Arabic number to Roman number
How to make this conversion? It doesn’t need to be the algorithm ready, wanted a help at least in logic.
-
8
votes5
answers23915
viewsHow do I know if the variable is an integer in Python?
How can I know if the variable is an integer in Python? I know how to do it in PHP: is_int($variable); // bool(true) But how can I do in Python? Example: numero = 1 #é numero nao_eh_numero = 'texto'…
-
8
votes4
answers8025
viewsCheck if int is "null" in C#
Cannot assign on C# null at an integer value (int, nay int?). However, how can I know if an integer value (int) has not yet had an assigned value (being of the type int)? int? valor; if (valor ==…
-
7
votes3
answers49921
viewsConvert string number to PHP integer
I’m converting a string to an integer in PHP, but at the return of settype($variavel, "integer"), or (int)$variavel bring me a null value or equal to 1. Have another way to try the conversion? The…
-
7
votes2
answers1882
viewsHow to convert a text to number?
How should I convert a text that I know is an entire number coming externally? It would be something like a ToInt() or something like that.
-
7
votes3
answers4835
viewsIt is possible to concatenate numbers of type int
For example 10 and 12, concatenated would be 1012, this without being string, it would have to be the whole kind, you can do it?
-
6
votes1
answer712
viewsWhat is the concept of integers signed in a programming language?
I would like to clarify the meaning of the term "whole signed". I’m researching protocols, to build one in Java, and sometimes I find the term. I don’t know what it’s about. I’ve always heard of…
-
5
votes1
answer199
viewsConvert uint16_t to int
I’m doing a project where a distance detector stores the distance in a variable uint16_t, and I need to turn it into int to make comparisons, but I can find nowhere how to do it. How to do?…
-
4
votes2
answers2761
viewsPHP value rounding error
I have a problem, after assigning to a variable a float value as below, 4.85, after multiplying by 100, 48500 and when I print out the value of 00000000484. $variavel = 4.85; $valor = $variavel *…
-
4
votes1
answer368
viewsOverflow by multiplying two integers in Biginteger
I am starting studies in Java and have a task: generate two random integers and store their multiplication. For this, I tried to use long and BigInteger. But the result of this multiplication is…
-
4
votes1
answer337
viewsHow to declare an integer type variable in C#?
I’m learning C# to migrate a system in VBA to C#. I’m really enjoying the language . NET. How do I declare an integer type variable?
-
4
votes2
answers118
viewsWhy does comparing different objects return true?
First code: Integer i1 = 1234; Integer i2 = 1234; System.out.println(i1 == i2); //false System.out.println(i1.equals(i2)); //true Even though it seems that primitive types are being used, they are…
-
4
votes2
answers1153
viewsHow to transform integers into byte in the Python language?
I’m using the pyserial module to send serial data, so I have a list of values like: Valores = [10,20,30,40,50,60,70,80,90,100] I need to transform the values of the list into bytes to send, because…
-
3
votes2
answers93
viewsWhat is the difference between these expressions?
In the srand’s handbook man srand says srand has as a parameter a unsigned int, but when using without cast the compiler does not complain. It has some possibility of going wrong if not using with…
-
3
votes3
answers2559
viewsIs it possible to add int with str composed of text and numbers in Python?
I asked that question Why in PHP the expression "2 + '6 apples'" is 8? here for finding this behavior strange. And in the case of python? I can convert the string '1' str for 1 int. Example: 1 +…
-
3
votes1
answer1906
views -
3
votes2
answers1159
viewsConvert string to integer
I can’t convert my text TextBox in one piece. namespace Pag98_Exe1 { public partial class frmveiculos : Form { public frmveiculos() { InitializeComponent(); } Veiculos veiculos = new Veiculos();…
-
3
votes2
answers275
viewsHow to write a program that fills a 10-position vector with random integers between 0 and 20?
How do I create a vector v of 10 random elements in which each element is one whole between 0 and 20? I tried to use the function np.random.random((1,10)), but the output was a vector of decimal…
-
2
votes2
answers2690
viewsincompatible types when assigning to type 'int *[]' from type 'int'
I created a size vector defined by a constant, and when calling a function that returns me an integer vector, this error is generated: incompatible types when assigning to type 'int *[]' from type…
-
2
votes1
answer841
viewsConvert Enum variable to int in C#
I have the following code: enum type = { OPEN = 0, CLOSED, UNDEFINED}; list<int> frequencia = new list<int>(new int[] {0,0,0}); I would later like to carry out the following operation:…
-
2
votes1
answer3327
views -
2
votes2
answers67
viewsError displaying the sum of three arrays read
#include <stdio.h> #include <stdlib.h> int main() { int i, notas[5]; int soma = 0; for(i=0; i<3; i++) { printf("Digite os tres numeros:\n"); scanf("%d", ¬as[i]); } for(i=0;…
-
2
votes2
answers52
viewsreturn Coredat - Swift
I am unable to assign a textField with the result of a search when it is int, with the right string var results:NSArray = try context.executeFetchRequest(request) as! [NSManagedObject]…
-
2
votes2
answers864
views -
2
votes1
answer721
viewsTransform int to python byte
Hello, Need to transform a value int to byte. I tried to do it this way: import serial ser = serial.Serial('/dev/ttyACM0', 9600) angulo = 90 ser.write(angulo) #while 1 : print ser.readline() I need…
-
2
votes1
answer346
viewsArray of Boolean for Integer
How can I transform a Boolean array, boolean[] bits in his Integer correspondent? I have a function that does exactly the opposite, but I didn’t understand it enough to be able to reverse it. int…
-
2
votes1
answer66
viewsDifferent values between variable without value and variable with null value?
#include<stdio.h> int main ( void ){ int die1[7]; int die2[7]; int sortedDie, i; srand(time(NULL)); printf("Rolling die 1\n"); for( i = 0; i < 6; i++){ die1[i] = 1 + rand()%6; }…
-
2
votes1
answer360
viewsExport Table to Excel, Problems with String Numeric
I looked here in Stack, but maybe I did not find the right question, I am exporting data from PHP to Excel with HTML tags, it exports in a good way, I happen to have a column that is String, for…
-
2
votes1
answer2339
viewsHow to make a sum of two matrices generating a third in c#?
I can’t do it, I tried using the FOR loop and also the IF to store in the matrix before making the sum, but my knowledge in c# is scarce. and the matrix is a 2x2.
-
2
votes2
answers495
viewsProblems with fwrite in binary file
I am trying to write and read an integer in binary file with the following code: #include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct{ int free_slot; }header;…
-
2
votes2
answers807
viewsPrimitive type int() in Python
I am beginner(1 semester of TADS), the maximum programming I saw was programming logic and now I’ve started to study Python. In the course of Python Video Course he taught that the primitive type…
-
2
votes1
answer340
viewsPython : 'int' Object is not iterable Random function
I’m having this mistake when I run the code. If I define pos=(algum numero qualquer) code runs normally ,but if I use this error function. 'int' Object is not iterable in line 20 at first. Where am…
-
2
votes3
answers3749
viewsProblems with input results after using an "int()"
Code example: idade = input("Qual a sua idade? ") int(idade) if idade >= 45: print("Tá velho cara, já era!") else: print("A vida está só começando rapaz!") Error found: Qual a sua idade? 45…
-
2
votes1
answer462
views"unsigned int" and "int," what’s the fastest?
In language C, enter unsigned int and int, what is the fastest type? I know (think) that unsigned can store larger numbers why int reserve a bit (space) for the signal and unsigned no. But which the…
-
2
votes2
answers1154
viewsWhat type of variable allocates less memory, integer or string?
Imagining the situation I’m taking from the database a field number, which represents the client’s code. This value tends to be between 1 to 50000. I must for this case save as string or how integer…
-
2
votes1
answer889
viewsconvert whole to java string
How do I convert the Integer to String type in Java? The variable matricula is declared as whole, but to show it on the screen it asks to convert it to String.…
-
2
votes3
answers111
views -
1
votes1
answer498
viewsZero left inside integer variable
Good afternoon guys, you hit the following doubt: When I define within an integer variable the zero the left it returns me in echo a number nothing to see, I wonder why: Follows exemplification:…
-
1
votes2
answers343
viewsWhen to convert a 32-bit to 64-bit code in iOS
I know there is a lot of information about converting a 32-bit to 64-bit code on iOS. However, I still have many doubts and I believe that they are the same of other people, especially in the issue…
-
1
votes1
answer889
viewsInsert values from an array of bytes into an int array without converting them
I have this vector int: int[] vetor = new int [dataRegCodeToCompare.length]; and that byte vector : (which receives the "Digest" of another byte array) byte[] dataRegCodeToCompare =…