static char* input=NULL;
char* output=new char[strlen(input+1)];//statement1
char* output=new char[strlen(input)+1];//statement2
what is the difference between statement 1 and 2…what exactly happens in statement 2 and 3 …please explain in detail…
Character array
hello @kani001
if u note the first statement then in that we are using strlen(input+1)
for example -> if input is “abc” then input+1 will indicate string bc(i.e string from index 1) and strlen will return lenght 2.
and output array will be declared of size 2.
where in second statement we are using strlen(input)+1
so first strlen(input) will give 3 (for abc string ) and +1 will result to 4.
so in total in second statement we will declare char array of size 4.