typedef struct {
char *word;
} STR;
int main()
{
STR *arr=(STR*)malloc(5*sizeof(*arr));
STR[2].word=(char*)malloc(200*sizeof(char));
STR[2].word=(char*)
#include
#include
typedef struct{
char *word;
}STR;
int main(){
STR *arr=(STR*)malloc(5*sizeof(STR));
arr[2].word=(char*)malloc(200*sizeof(char));
if(realloc(arr[2].word, 400*sizeof(char))==NULL){
/* increasing char array size from 200 to 400 failed. 200 char array was unchanged */
printf("increasing array size not OK\n");
}
else{
printf("increasing array size OK\n");
}
free(arr[2].word);
free(arr);
return 0;
}