1.

Char *p="sampletext" , *q ="sampletext"; Are These Two Pointers Equal ? If Yes , Then Explain?

Answer»

In C, strings(not array of characters) are immutable. This means that a STRING once CREATED cannot be modified. Only FLUSHING the buffer can remove it. Next point is, when a string is created it is stored in buffer. Next time, when a new string is created, it will CHECK whether that string is PRESENT in buffer or not. If present, that address is assigned. Otherwise, new address stores the new string and this new address is assigned.

In C, strings(not array of characters) are immutable. This means that a string once created cannot be modified. Only flushing the buffer can remove it. Next point is, when a string is created it is stored in buffer. Next time, when a new string is created, it will check whether that string is present in buffer or not. If present, that address is assigned. Otherwise, new address stores the new string and this new address is assigned.



Discussion

No Comment Found