Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
3 answers
101 views

In C, why can a variable holding a char array be assigned to a pointer, but the address of the same pointer cannot?

Consider the following code: char stringy[] = "There's too much confusion, I can't get no relief!"; char *pStringy; pStringy = stringy; This compiles - stringy is an array of characters, ...
Bennypr0fane's user avatar
2 votes
1 answer
62 views

C# generic method detect if T is array and then index into the array

I'm trying to write a Dbg debug function that will print out some debug info about the given parameter and then return it. I would like arrays to be printed as the list of elements, and scalars to ...
beyarkay's user avatar
  • 809
1 vote
1 answer
32 views

Extract Generic Interface or Type keys as an Array [duplicate]

I want to know if it's possible to get a generic interface or type and get it's properties like an array of objects, like this: interface UserData { email: string } keys = extractKeys<UserData&...
João Pedro's user avatar
0 votes
2 answers
64 views

func argument with an Array of mixed types (protocol), then call a static method of the protocol

Here are my structures (I can have lot more, that why I need a generic way to do with MyProtocol): protocol MyCustomCodable { static func buildQuery() } struct A: MyCustomCodable { ... } ...
Guillaume PELOUAS's user avatar
-1 votes
1 answer
53 views

Confused about JSON and Array in TypeScript

I get data from the database with Sveltekit and nodejs and always fetching data like that ... responseData = await response.json(); It returns Object and I can assign it to an array let getData = []; ...
kin's user avatar
  • 21
2 votes
1 answer
73 views

How to make packing and unpacking functions generic?

I would like to make these two functions generic: /** * Unpack an element if it is packed. * @param data - Data from which to unpack. */ export const unpack = ( data: undefined | string | string[]...
Géry Ogam's user avatar
  • 7,407
1 vote
1 answer
78 views

How do I get a type safe function return value in this case?

In the below code example I would like my IDE to accept mySap.rootValues[0].test2 and mySap.rootValues[1].test4 as valid. Right now, it doesn't, because rootValues[0] and rootValues[1] are of type ...
msbb's user avatar
  • 53
3 votes
1 answer
174 views

PHP FFI - Convert PHP array to C pointers array

I have a C function with the following signature. It accepts (from my humble C understanding) an array of C strings and returns a pointer to a random string. const char *get_random(const char *const *...
Slava.In's user avatar
  • 931
0 votes
3 answers
72 views

VBA function works within a sub procedure but not on the excel worksheet: "value" error. Probably an issue with one argument being an array

I want to write a function which given 2 arguments (2 dimensional array with n rows and p columnns and a number i) it will return the i^th column of the matrix. I have written this code using an array ...
Jean Cartier's user avatar
0 votes
2 answers
156 views

What are the types of arrays with variable size and accommodating different types in Nim?

Nim is my second language after Python. Python has a universal array type, the "list" type. It has a changeable size and can accommodate any type. I am currently sorting out and studying Nim ...
Lucius_Will's user avatar
-1 votes
3 answers
71 views

Possible to use python native lists to replace array altogether? [closed]

I come from PHP background so i am very used to arrays with key->value pairs e.g. array[0] = "One" array[1] = "Two" array[3] = "Three" Then i could unset(array[2]) ...
Roman Toasov's user avatar
0 votes
0 answers
72 views

Dot indexing is not supported for variables of this type. Don't work in newer version

function [LIMP,n] = vvod clear all; P = dir('*.txt');% filepath n = length(P);% number of files for i=1:n FI=P(i).name; fopen(FI); LIMP = importdata(FI); Data(:,:,i)=...
Evgeniy's user avatar
0 votes
1 answer
343 views

Types for the data from supabase

1 I'm trying define the types for the data from supabse I cannot and I got the error message. "type '{ id: string; title: string; capacity: number | null; start_date: Date | null; start_time: ...
Yuki Sakiyama's user avatar
0 votes
2 answers
127 views

Consistently iterate API response which may be an object or an array of objects

I have the following JSON code. { "Artikelnr":"1000", "Vooraad_NL":2.0, "Voorraad_DE":1.0, "Voorraad_BE":0.0 } When I loop through the json ...
Matthijs's user avatar
0 votes
1 answer
31 views

Why does typescript dons't do typecheck on a 2d array?

I have this simple code to generate a 2d array: type cell = { id: string; }; const board: cell[][]; board = Array(10) .fill("") .map((x) => Array(10).fill(ANY TYPE CAN GO ...
TheNormalPerson's user avatar

15 30 50 per page
1
2 3 4 5
62