Questions tagged [variable-length]

Refers to anything whose length can vary

Refers to anything whose length can vary

290 questions
2
votes
6 answers

a C program crashes, using a double-type variable length array

I am reading C Primer Plus these days and here is the code I wrote for the programming practice No.4 in Chapter 10, finding the index of the largest number in a double-typed array. I used variable length array in order to manually specify the array…
endless
  • 97
  • 1
  • 4
2
votes
1 answer

One way hash with variable length alphanumeric output

I need to one way hash alphanumeric + special chars(ascii) strings of variable length (10-20 chars). The output should be of variable length but max 25 chars long, alphanumeric and case insensitive. Also I do not want to produce collisions so I need…
Chris L.
  • 23
  • 4
2
votes
2 answers

Method that takes in an undefined number of arrays

A while back I was playing with methods using variable-length argument lists (java) that get defined as below public static int[] makeArray (int... a) { return a; } this is a silly program but what it will do is take in an undefined amount of…
1
vote
1 answer

ANTLR: parsing header followed by binary data chunk with unknown length

There in a data stream are two packets. Each has the header followed by some binary data with unknown length, until another header is found, or EOF is reached. Here is the data: HDR12HDR345 HDR is the header marker 12 and 345 are the binary…
vita
  • 21
  • 3
1
vote
1 answer

Checking the significance of the difference between two groups of different length

I need to check if the difference between land surface temperature in the past and present within the LULC is statistically significant. LULC units changed over time and the length of the temperature data changed as well because the class grew. I…
1
vote
0 answers

Decode LEB128 getting wrong results

I'm trying to implement LEB128 to write a custom Minecraft Server implemention. I'm doing so by following Wikipedia article about LEB128 and port example Javascript code given to C. https://en.wikipedia.org/wiki/LEB128 #include #include…
1
vote
2 answers

Why do I get "TypeError: Cannot read property 'length' of undefined" when using length method

I wrote a function that returns the longest word const longestWord = (phrase) => { const arr = phrase.split(" "); let longest; for (let i = 0; i < arr.length; i++) { if (arr[i].length < arr[i+1].length){ longest = arr[i+1] …
Normye
  • 45
  • 4
1
vote
1 answer

Laravel rule to checking length is not equal to N

We have defined some rules in laravel but we need rule in which length of string should not be 5. code is given below. $rules = array( 'id' => 'required|numeric|digits_between:7,8' ); current rule is length would be in between 7 and 8 but i need to…
1
vote
1 answer

Creating Table in R Using List of Values from Another Dataset with Different Length

I have a dataset of 50,000+ observations and I'm trying to create a table of my two variables of interest, chemical and lab_code. The code below outputs a working table that can be used to create a basic heatmap, but like the the main dataset, it…
Irene
  • 47
  • 8
1
vote
1 answer

how to calculate the size of the string with /0 inside which a pointer points to

let say I have a char pointer like this: unsigned char* value="Hello\0Hello"; how can i calculate the size of value, as strlen only calculate the size of string until the '/0' so I can not use strlen, and also sizeof returns the length of the…
Lia
  • 33
  • 6
1
vote
1 answer

is it safe to make a VLA slightly longer than argv[1]?

Example code, treats argv[1] as a file path, replacing its extension with .png or appending it if none is found: #include #include int main(int argc, char **argv) { if (argc != 2) return 1; char *lastdot =…
1
vote
1 answer

How to get the length of a formula in R?

I am trying to get the length of the following formula: myformula <- ~ (1 | Variable1) + (1|Sex) + Age + Cells + Glucose But for some reason, R doesn't recognize the real number of elements (which is 5) str(myformula) Class 'formula' language ~(1…
emr2
  • 1,436
  • 7
  • 23
1
vote
0 answers

Excel: Extracting numbers from a string with variable length

I have a column with data that looks like this: Day D003 D004 D008 D010 D012 D028 And in the next column, I need to extract just the 3, 4, 10, 12, etc. with NO leading 0's. I tried the following: =IF(D8="D003…
1
vote
1 answer

Trying to count number of elements but it returns zero

The elements:
class="product-image-container"


The code: countMaterials(){ let countItems = 0; cy.get('#center_column').find("div").then((items) => { countItems = items.length; }); return countItems; } I'm…
yuv
  • 139
  • 1
  • 1
  • 5
1
vote
3 answers

Getting error when trying to calculate the length of the array after sort in python

I am totally confused on the below code execution, a= [10,30,4] a = a.sort() r = len(a) - 1 print (r) When the above code is executed I get r = len(a) - 1 TypeError: object of type 'NoneType' has no len() However the code runs fine if I find the…
Selva
  • 43
  • 3