V
V
Vladimir A2020-09-15 21:54:14
C++ / C#
Vladimir A, 2020-09-15 21:54:14

How to output an array in C?

Good evening!
I have a dynamic array

int *p_array = (int *)malloc(sizeof(int)*5000);

как правильно вывести данные, например, с 50 по 5000 символ?

for (int i = 50; i < 5000; ++i)
    {
       printf("%D", p_array[i]);
    }


this loop will display from element 0 to 5000, and not from 50. The

example is conditional, because the task is different, it’s not just to display data.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CityCat4, 2020-09-16
@hauptling

The code shown in the example cannot output anything other than an array from the 50th to the 5000th element. If the task is different - well, bring the specific code. Or don't bring it up and figure it out yourself, gdb will help you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question