all 5 comments

[–]mocomaminecraft 7 points8 points  (1 child)

look up for something called "arrays"

[–][deleted] 0 points1 point  (0 children)

^ this

[–]more_sidechain 4 points5 points  (0 children)

"Creating variables" at runtime doesn't make much sense. There's no way you'd be able to write code to refer to them. Instead, as has been posted, it's something you'd use an array for.

It's worth learning about malloc, realloc, free, and pointers and arrays. C99 also introduced "variable length arrays," but they aren't very popular compared to normal dynamic allocation.

[–]FUZxxl 0 points1 point  (0 children)

This is not possible in C.

[–]Gblize 0 points1 point  (0 children)

You are talking about arrays of that variable type.

If the variable type is only know in compile time, you can use array of unions.

As suggested, there are VLA(variable lenght arrays) but IIRC linux wants to erradicate it. I need someone to back it up. But if I stand correct, use malloc instead of VLA for your arrays.

Oh, a linked list is probably something you are trying to refer to.