hi guys is it posible to generate numbers using array and link list in data structure? example generating number 1 to 5000, can you give me some examples?

Recommended Answers

All 3 Replies

What do you mean by "generate"? Are you trying to write an arbitrary length number library or something?

hi guys is it posible to generate numbers

Yes it is.

using array and link list in data structure

The infinitive verb "to use" can mean almost anything and can be used with nearly any noun in the accusitive case, making the meaning of your sentence fairly ambiguous. For example, do you mean "to store the result of the generation in a data structure", or do you mean "to use the data structure in some way as a state to generate the series of numbers itself." Both cases are "yes" though. Futhermore, arrays and linked lists are both instances of data strucutures, so I'm not sure if you mean "to use arrays and linked lists in other data structures" or if you mean "to use data structures like arrays or linked lists." Both cases are again "yes".

can you give me some examples?

Sure. Something like this should work:

#include <stdio.h>

int main()
{
    int s[] = {5};

    for (int i = 0; i < 100; i++)
    {
        printf("%d\n", s[0]);
    }

    return 0;
}

Yes, it is possible to generate the numbers from 1 to 5,000 using array and linked list in data structure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.