Questions tagged as 'int'

2
answers

What is the difference between these expressions?

In the srand manual man srand it says that srand has a unsigned int as its parameter, however when using it without cast the compiler does not complain. Is it possible to go wrong if you do not use cast (unsigned int) ? If ye...
asked by 30.08.2014 / 07:12
1
answer

Convert uint16_t to int

I'm doing a project where a distance detector stores distance in a uint16_t variable, and I need to turn it into int to make the comparisons, but I can not find anywhere how to do this. How to do?     
asked by 29.11.2017 / 04:27
2
answers

Why does the comparison of 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 Although it seems that primitive types are being used, they are actually objects, so when these objects are co...
asked by 21.02.2017 / 22:38
2
answers

Convert string to integer

I'm not able to convert the text from my TextBox to integer. namespace Pag98_Exe1 { public partial class frmveiculos : Form { public frmveiculos() { InitializeComponent(); } Veiculos...
asked by 21.10.2016 / 02:44
1
answer

Convert 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 like to do the following operation: type t = enum.OPEN; frequencia[t]++; But I can not....
asked by 08.05.2014 / 19:04
1
answer

Transform int in byte into python

Hello, I need to convert an int value to byte. I tried to do this: import serial ser = serial.Serial('/dev/ttyACM0', 9600) angulo = 90 ser.write(angulo) #while 1 : print ser.readline() I need to send a value to the Arduino, at first,...
asked by 30.05.2017 / 01:48
1
answer

Different 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; } printf("Rolling die 2\n"); for( i = 0; i <...
asked by 08.01.2017 / 04:48
2
answers

Error displaying the sum of three read arrays

#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", &notas[i]); } for(i=0; i<3; i++) {...
asked by 18.05.2015 / 22:49
2
answers

Problems with fwrite in binary file

I'm trying to write and read an integer in a binary file with the following code: #include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct{ int free_slot; }header; void main(void){ FILE *fd = fopen("te...
asked by 30.10.2017 / 17:06
1
answer

Boolean Array for Integer

How can I transform a boolean array, boolean[] bits into its corresponding Integer ? I have a function that does exactly the opposite, but I did not understand it enough to be able to invert it. int input = 62; boolean[] bits...
asked by 31.08.2017 / 21:13