14th Oct 2023, 6:36 PM
Theo Martier
Theo Martier - avatar
6 odpowiedzi
+ 2
I used pointer to assign the value, you can't assign directly any value to string Here is the updated code https://code.sololearn.com/cNTTy2QmHwEJ/?ref=app
14th Oct 2023, 7:36 PM
Tarun Gautam
Tarun Gautam - avatar
+ 1
Thanks Tarun, i'vr tried with pointer, but not like that! 👍
14th Oct 2023, 9:18 PM
Theo Martier
Theo Martier - avatar
+ 1
Because y is a array. Do a for loop. Another way is to go with the pointer in the char.
14th Oct 2023, 9:27 PM
Werg Serium
Werg Serium - avatar
+ 1
Theo Martier char* is better. But if you want to work with char array, you could use strcpy int main() { char y[8]; int x = 4; x >= 5 ? strcpy(y, "true") : strcpy(y,"false"); printf("%s", y); return 0; }
16th Oct 2023, 8:48 AM
Bob_Li
Bob_Li - avatar
+ 1
Thanks Bob!
16th Oct 2023, 11:28 AM
Theo Martier
Theo Martier - avatar
0
Thanks you Werg
15th Oct 2023, 6:54 PM
Theo Martier
Theo Martier - avatar