+ 4

There's a problem in my C code,Could anyone help me please

Hi guys,could you please help me with my code? #include <stdio.h> #define { BEGIN #define } END #define main() START #define STARS "******" main() { printf(STARS); printf("\nThere are 6 stars above and 6 stars below"); printf(STARS); } The compiler gives error for the { and }

4th Oct 2018, 3:43 PM
Nika Soltani Tehrani
Nika Soltani Tehrani - avatar
4 odpowiedzi
+ 1
Thank you a lot but I need my code for an exercise for my university,and I must mention these #define parts.It's an exercise that wants us show how we can replace one character with another by using define
4th Oct 2018, 5:05 PM
Nika Soltani Tehrani
Nika Soltani Tehrani - avatar
+ 1
wow ,thanks a lot
4th Oct 2018, 8:17 PM
Nika Soltani Tehrani
Nika Soltani Tehrani - avatar
0
The only special character that can be used in the name of a varible, expression, etc in C is the underscore. I am unsure what you are trying to do with #define BEGIN and #define END but they are not need as well as the main. Check out this code and see if it was what you were wanting to happen. https://code.sololearn.com/cjGdR3fRzwCQ/?ref=app
4th Oct 2018, 4:49 PM
Ryan
Ryan - avatar
0
Ahh gotcha. If the prompt was given exactly like that idk, but other wise I think I https://code.sololearn.com/cjGdR3fRzwCQ/?ref=app found a workin solution. Seems you just have a few of the parts mixed up
4th Oct 2018, 6:35 PM
Ryan
Ryan - avatar