0

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?

Edited by hydra.p: Moved to C.

4
Contributors
3
Replies
18
Views
3 Years
Discussion Span
Last Post by Scotthiggins
0

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;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.