-2

Can anybody explain the difference between " " and ' ' in c programming? its getting to mi example:

if i use ' '

date=type=='a';
if (date)
{
printf("its a date");
printf("%d",date);
}

it prints 1 and if i use " "

date=type=="a";
if (date)
{
printf("its a date");
printf("%d",date);
}

it prints 0

Cheyenne Forbes
  • 491
  • 1
  • 5
  • 15

1 Answers1

10

Double quotes is for string and single quotes for character. But since you are using character in both of your samples then it doesnt make any difference. You can store character using double quotes but not the vice versa

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331