Avatar of ol muser
ol muser
Flag for United States of America asked on

Initialize struct in C

Given struct A, what is the difference between these two initializations?

//begin code

C c1 = {0};

C c2 = {0,};

//end code

Yes, I see some places where they initialize with a zero and a comma.
C

Avatar of undefined
Last Comment
ol muser

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Zoppo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
evilrix

There is absolutely no difference. The trailing comma is just a syntactic convenience, as alluded by Zoppo.
ol muser

ASKER
Thanks
ol muser

ASKER
Thanks both
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck