Hey guys, I'm trying to get into C and C++ from PHP and Java. Obviously I may be biased towards the two that I find easier. However, I have run into several problems that are ruining my experience with this language.
First is the terrible implementation of strings. Especially in C.
QQ aside, I wanted to know how to make something like this work;
the problem here is that the compiler wont accept anything other than a constant char value.Code:char szX = "1"; char szY[12] = "gugugaga" strcat(szY, szX) //I want "gugugaga1"
The code above is part of the while clause and as such, the value of x changes every time the loop runs.
Another question would be
Does the C compiler automatically place a "/0" at the end of y[12]?
Assuming that I am new to this language and the nuances of pointers and such like have not been completely mastered. How can I join the two strings?
TL;DR: How do I get the strcat to join to variable char strings? How do I do it at all?