what does a=b means in C programming?
which one is value and which one is register? it seems really confusing if you look at it deeply. is there any standards(predefined) in C? imo it is value of b goes to register a.
- 4 weeks ago
It means b is assigned to the memory location of a. If it is a value type then the value is assigned. If it is a reference type then the reference is assigned. Who cares how the architecture handles it with registers etc.? If you really want to know that you can disassemble it and get a headache.
- River EuphratesLv 71 month ago
It means you are going to either:
a) Fail your C programming class.
b) Get fired from the company who you convinced that you could program in C.
- ?Lv 71 month ago
the one after the equals is always the value of the register, which is before the equals.
in this case, the value is also a register that was set previously.
- EddieJLv 71 month ago
You have to declare a variable as a register variable if you would like it placed in a register, but it is still up to the compiler whether or not to do so.
Meanwhile, what would
3 = a;
In BASIC, they have a keyword, <LET>, that helps new programmers understand.
In BASIC, you can say
LET a = 3
but it would make sense to say
LET 3 = a
because you can't let 3 be anything but 3.
But, COBOL has a <MOVE> command:
MOVE 3 to a;
C moves values from right to left, like BASIC. So, if it help you, in your mind, put a <LET> in front of your assignment statements
And, in general, think about "variables" instead of "registers". Registers are places where work (calculations) are done, and values are moved in and out of them as needed to get the work done, but most values are in memory locations.
- How do you think about the answers? You can sign in to vote the answer.
- Anonymous1 month ago
C uses the stack for local variables (unless you use malloc()), not registers (unless you declare the variable to be a register variable). Your example copies the value of b into variable a on the stack.