I am trying to print int array with %s. But it is not working. Any ideas why?
#include<stdio.h>
main() {
int a[8];
a[0]='a';
a[1]='r';
a[2]='i';
a[3]='g';
a[4]='a';
a[5]='t';
a[6]='o';
a[7] = '\0';
printf("%s", a);
}
It prints just a. I tried with short as well, but it also does not work.
int a[8]tochar a[8]? Whats different about the two? How do you think that difference affects howprintf()formats and emits a string to stdout?