What does absolute and relative means? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What does absolute and relative means?

22nd Sep 2016, 6:03 PM
Priyanka Sahu
Priyanka Sahu - avatar
4 Answers
+ 11
Say you have a file structure that goes a/b/c. If you are working in c, you can reference any file in directory c by just typing the name of that file. That is relative because your reference is relative to your position. But let's say one day you are working in directory e/f/g and want to use the file in c again. You can't just type the file name because the computer won't find it in g. So you have to write /a/b/c/filename to find it. That is absolute because it starts at the root directory and follows the full path to the file you want. Absolute references are usually longer to type but will always find the file you want no matter what your current working directory is. Relative references can be shorter but if you change working directory without bringing needed files with you, you can't use the same reference to find those files.
29th Sep 2016, 9:39 PM
Ryne
Ryne - avatar
0
This means we can say absolute means the actual path and relative is a reference to that file . Right?
30th Sep 2016, 3:12 AM
Priyanka Sahu
Priyanka Sahu - avatar
0
You could say that I guess. But relative is not really a reference. It's the path to the file from where you currently are.
30th Sep 2016, 3:19 AM
Ryne
Ryne - avatar
0
okay. Thank you for the help.
30th Sep 2016, 3:54 AM
Priyanka Sahu
Priyanka Sahu - avatar