+ 2

Is there a way to do a list comprehension in C similar to the way python does it?

Basically I'm trying to do this: arr = [for i in range(65, 91)] I'm completely lost and new to C, any help would be appreciated.

10th Feb 2022, 5:24 AM
Dylan Campbell
Dylan Campbell - avatar
2 Antworten
+ 3
As built-in syntax or syntactic sugar: no. C does not even have built-in collection types like C++ has, or python. What you can do is simulate this behaviour with functions.
10th Feb 2022, 5:56 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 1
Is this kinda like what you want? https://code.sololearn.com/cysSweKJWKpK/?ref=app
10th Feb 2022, 9:53 AM
HungryTradie
HungryTradie - avatar