Char initialization

Hi All,

char a[5]="\0";

a) a[0] contains \0
a[1] contains garbage value

b) a[0] contains \
a[1] contains 0
a[2] contains garbage value

Pls, let me know correct result is a or b. I guess a.

Thanks,
Naga:cool:

There's a simpler way for you to do your homework. Write a C program with this case and let it print out the (numeric) values of the array. Compile, run, learn.

I have to agree with pludi. You are asking a homework question. Please try it out on your own and see the results for yourself.

Closing this thread.