In C why don't variable names need terminating null chars, they are strings after all
I can't believe this shitty language pretends to not have strings but they were staring us in the face the whole time!
In C why don't variable names need terminating null chars, they are strings after all
Other urls found in this thread:
eli.thegreenplace.net
twitter.com
You're confusing symbols and literals for strings.
A string is words idiot
You're unfit for programming.
no u
>A string is words
And symbols aren't words, they represent lvalues.
Why do females have penises? They're females after all.
Wtf are you even babbling about, variable names are words not lvalues
>variable names are words not lvalues
Stop trolling and educate yourself:
eli.thegreenplace.net
How can one char variable name resolved to a 64bit memory location idiot
char a;
printf("%p\n", &a);
The variable name only counts as a string of it's more than one char, try again
obviously the compiler is adding the '\0' itself, which it doesnt do for char arrays because its selfish
such a qt3.14
i would do naughty things to her and love her like a psychopath dad
that's Tsuruko, she is pure.
she is pure
pure semen
what does the &a do
I thought it was for assigning an input to a variable with scanf
t. brainlet
Variable names do not exist at runtime.
STOP.
>add a string
>copout and just say it doesn't exist
C is pure shit
rubyist@Overmind:~/cs/scratch$ cat nope.c
#include
int main(void)
{
const char *hurrdurr = "Hello World!";
puts(hurrdurr);
return 0;
}
rubyist@Overmind:~/cs/scratch$ gcc -o nope nope.c
rubyist@Overmind:~/cs/scratch$ strings nope | grep hurrdurr
rubyist@Overmind:~/cs/scratch$ ./nope
Hello World!
you really should find something else to do user...
A variable is lit just a place in memory that holds data for you, be it an integer, floating point, string, class or whatever
i would let him dick my anus
a variable with a string for a name...
rly makes u think
how long are c 'programmers' going to keep up this charade
>tfw no hapa gf who dresses up as anime characters for me
We honestly need to petition to government to start a girl farms to breed us hapa girls in the states. They are rare as fuck on the east coast
its the lvalue of the variable, so in this case where the string name is located
Takes the memory location of that variable, it's called dereferencing if I'm not mistaken
Because they aren't strings. Think about what each of these compiles down to:
Strings / character arrays / any variable really:
The compiler assigns a memory location. If the variable is in a function, that will be a location on the stack that gets allocated every time the function runs. If it's a global, it's a set memory address hardcoded into the executable. Then as the compiler works through your code, translating it to machine code, it uses that variable name as a name for that address. Whenever you say that name, it translates it to that address. So it's really just an address, and you're giving it a fancy name so you can read the code. The variable name itself doesn't even end up in the executable (which makes it smaller as well as more difficult to reverse engineer).
String / character array literal values:
When you say a value you want the program to put into a string, it has to put that string into the final executable in some way, so the program can use it. If the final executable is dealing with a string, it's going to scan through it and need to know where the end is. So you have to have a null character at the end to keep it from running off the end into other data.
didnt read this post
didn't read this one
I know u did
tsurukoooo
Tsuruko is CUTE!!