+ 1

Here after n=n+1 does realloc allocates size of n+1 only or n+n+1?

reallco https://code.sololearn.com/c53Fj5Ys4wgI/?ref=app

2nd Feb 2018, 2:17 PM
Bhuvanavalli Thiyagarajan
Bhuvanavalli Thiyagarajan - avatar
2 Réponses
+ 1
thanks
2nd Feb 2018, 2:41 PM
Bhuvanavalli Thiyagarajan
Bhuvanavalli Thiyagarajan - avatar
0
n=n+1 will change n to n+1 only. So realloc will change the final size of a to n+1. You may verify the same by printing : sizeof(a)/sizeof(a[0]);
2nd Feb 2018, 2:40 PM
ProCpp