+ 1
What is hard code?
i sometimes hear about hard coding but i have no clue what it actually is could someone explain thanks.
3 Respuestas
+ 7
This link would make it clear, hopefully.
https://en.m.wikipedia.org/wiki/Hard_coding
+ 2
Consider this Eg :
int a = 5;
int b = 6;
int c = a + b ;
print(c)
In the above code you are assign values in the code itself. This is called hard coding. How many time s you run this code it gives one answer only i.e., 11. Hence hard coding is not a good practice , since input values are decided as per the wish of end user. You should code in such a way that end user can give any input , but at the end your code should give the desired output. I hope you understood. Im not good at english.
0
For example
if you print quoted strings of characters, or do calculations directly using numbers, rather than using variables and constants defined only once in the code, those values are "hard coded".
It often makes the software more difficult to maintain, especially if the hard coded values are used (duplicated) in different places,
because when you need to change them it is harder to find them all, or remember what the value mean.