Why am I getting error in this program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why am I getting error in this program

#include <stdio.h> int main(int argc, char *argv[]) { int x = 3, y = 5; if (x = = 3){ printf("\n%d",x); } else{ printf("\n%d",y); } }

25th Sep 2021, 1:41 AM
Sonam Kumari
Sonam Kumari - avatar
4 Answers
+ 2
== not = = remove the space
25th Sep 2021, 2:08 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
ChaoticDawg I was fixing the error since yesterday😀😇 thanks sir
25th Sep 2021, 2:23 AM
Sonam Kumari
Sonam Kumari - avatar
+ 1
Herr = = is illegal statement dont give extra space between these equality operators it was silly mistakes read error also u can debug it self . According to standard your main function type is it so your program should return int value or you can use this return EXIT_SUCCESS; for successful compilation to same as return 0 in case of failure u can use EXIT_FAILURE
25th Sep 2021, 6:59 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Jay Matthews There was an error by giving space
25th Sep 2021, 2:21 AM
Sonam Kumari
Sonam Kumari - avatar