+ 1

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

2 Antworten

+ 1

thanks

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]);

+ 1

2 Antworten

+ 1

thanks

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]);