Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@njpugh90 yeah I did and found the string library <string.h>
Will use that library next time, thanks ;) -
olback107946y
-
@olback no no no... ints are typically 4 bytes, each char is one byte. the string starts at the address allocated and builds out by a byte at a time. List<int> would be closer to what you're describing.
-
devios157016yOh dear children. A char array *is* a string in C. Welcome to low-level memory management.
-
@olback it's more about data structures, not really language specific. There's lots of resources online that go into details. It's really helpful information to have 😊
-
devios157016yA char is just a 1-byte unsigned integer. It’s just a number like an int but is called char because it usually corresponds to a character code. This was before Unicode of course. 🙂
-
devios157016y@segfault0xff You can definitely treat a char as a number in C. It's literally just an unsigned byte. You might get a warning if you try to print an int as a character, but you can do that too. C is very flexible.
C has no primitive bools either. It just uses an int value of 0 or 1 to represent false/true. BOOL is sometimes defined as char. -
devios157016yCorrection: anything non-zero is considered true in C. If false is defined as 0, true is more correctly defined as !false, however !0 == 1, so it amounts to the same thing.
-
@Torbuntu I mean we all know a computer is a rock we put lighting in then taught how to think....
-
mordax15966yI will defend C until the day I die. After being made to program in Java OOP for two years during high school without learning the basics of functional programming, C was the saviour of my software career.
C, I love you. -
Yes. Yes strings are a thing in c. That's why
char helloWorld[32] = "Hello world";
Automatically fills the char array with those values and ends it with a null terminator. Strings are built into the syntax of the language, they just aren't the high-level bullshit everyone is used to. -
Because there's no string data type in processor. In C you use primitive data types like char which is byte. Better be called byte as in c#. You can make array from characters with:
char string[here goes number of chars]; -
dmonkey21956y@Proximyst omg 😱 how is it? I'm very curious but sceptical because it's still alpha (is it, right?)
Related Rants
-
hashit6Substitute Teacher who apparently majors in Java sees my copy. T - Your programs are incomplete M - You mean ?...
-
BillLumbergh13The worst rejection in my case is being qualified for the jobs I get offers for, but not being able to work fu...
-
gameshark24!rant I managed to do a chunk of programming in class today without my partner to hold my hand through it. It...
Coded in C language for first time (due to college assignments)...
Just found out that there are no strings in c language 😐
rant
stop c
c is shit
c is crap
college sucks
c is assembly
c language
begone c