Reading into the array number using pointers

i had try. But if it does not have en error i would not be here.

how to write a program that random number entering into the array number using pointers?

for example :

enter marks for day : 87
enter marks for day : 80

1
2
3
4
5
int a[10];

int *p = a;

*( p + std::rand() % 10 ) = rand();
Topic archived. No new replies allowed.