I have written two different to print string in c programming
warning: initialization makes integer from pointer without a cast [-Wint-conversion]
char Book = "Electronics";
Program 2
Name of Book is Electronics
Why string doesn't store without array ?
Code:
#include <stdio.h>
int main()
{
char Book = "Electronics";
printf("Name of Book is %s \n",Book);
return 0;
}
warning: initialization makes integer from pointer without a cast [-Wint-conversion]
char Book = "Electronics";
Program 2
Code:
#include <stdio.h>
int main()
{
char Book [20] = "Electronics";
printf("Name of Book is %s \n",Book);
return 0;
}
Why string doesn't store without array ?