maayan maayan - 1 year ago 83
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 Source

Assuming your array called 'string' already exists, try

string[0] = 0;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download