maayan maayan - 4 months ago 10
C Question

Initialize a string in C to empty string

I want to initialize string in C to empty string.
I tried:

string[0] = "";


but it wrote

"warning: assignment makes integer from pointer without a cast"


How should I do it then?

Answer

Assuming your array called 'string' already exists, try

string[0] = 0;