You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (size>0&&size!=32761) //i.e. restricting from assigning -ve values & characters
break;
printf("\a");
}
char_array *arr=new_char_array(NULL,size); //Note: In C,there is no need to type cast the returned address from a function whose return type is 'void address'
if (strlen(arr->data)>0&&strlen(arr->data)<=size) //i.e. using strlen function to calc. size of array so that the string size does not exceed the limit
break; // & also it neglects null string
printf("\a");
}
printf("\nBefore Dynamic Reallocation:-");
printf("\nYou entered: %s\nsize of string: %d/%d",arr->data,arr->size,size);
arr=new_char_array(arr,strlen(arr->data));
printf("\nAfter Dynamic Reallocation:-");
printf("\nYou entered: %s\nsize of string: %d/%d",arr->data,arr->size,size);