Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Character initialization in c language

Tags:

c

I want to assign ' to a character but it keeps giving me error any help?

    void main()
    {
        char c  = ''';
    }
like image 858
YaserM Avatar asked May 15 '26 01:05

YaserM


1 Answers

Special characters like ' or \ must be escaped with a backslash in these situations. In this particular case you got an error because the compiler thinks you opened and closed a null character with the first two '' and then opened another character without closing it with the third one.

like image 69
Ed de Almeida Avatar answered May 17 '26 23:05

Ed de Almeida



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!