arrays - how to make a string empty in C -


i'm using c here.

char a[4], b = 'a'; int k = 0, count = 0; while true {     if count == 26         break;     if k == 4 {         k = 0;         count++;         b++;         //i want solution code here.         printf("%s", a);     }     a[k] = b;     k++; } 

i need know that, if string in c got assigned completely, possible empty string again? can show desired output.

aaaabbbbcccc........zzzz

please me.

in case, should suffice do:

a[0] = '\0'; 

this sets first char in string null terminating character, such when print string, prints empty string.

you should assign null terminating character after effective last character:

a[0] = 'a'; a[1] = 'b'; a[2] = '\0'; printf("%s", a); //print "ab" 

Comments