0
what is wrong with my c program
hello, this program compiles but at the execution something is wrong when I use quotation marks to replace apostrophes it works properly can someone explain why this issue? #include <stdio.h> int main() { int i=5,j=3,k; i++; j+=i; k=++j; printf('i= %d;j= %d;k= %d',i,j,k); return 0; }
4 ответов
+ 1
You can use single quote only for declare literal chars (eg a single char) while yoi have to use double quote for declare literal strings... Ex:
'c' is different from "c". The first is a character the second is a string builded up by character c followed by implicit null character '\0'.
You cannot declare a string using single-quote char but only a single char
+ 2
Thanks both i thought it was like python they were the same in like such case, ramphy aquino nova i knew what was wrong i just didn't know why
+ 1
#include <stdio.h>
int main() {
int i=5,j=3,k;
i++;
j+=i;
k=++j;
printf("i= %d;j= %d;k= %d",i,j,k);
return 0;
}
this is the problem ---> ''
+ 1
C/C++ have more strict rule on this and on other contexts