How to get environment variables in C

  Рет қаралды 9,537

CodeVault

CodeVault

Күн бұрын

Пікірлер: 19
@sampapap1188
@sampapap1188 Жыл бұрын
Good to see you back man, missed your videos
@soufianeamimi
@soufianeamimi Жыл бұрын
keep going bro you are doing such a great work
@hanaksi
@hanaksi Жыл бұрын
Thanks for video! It is good that you are back!
@nohatota8767
@nohatota8767 Жыл бұрын
Thank you for your helpful explanation, your videos always help me
@RDFR-cy4ov
@RDFR-cy4ov Жыл бұрын
Good to see you again
@marksvids1156
@marksvids1156 Жыл бұрын
I needed this 3 days ago, it was in my final exam lol
@CodeVault
@CodeVault Жыл бұрын
Damn... sorry for being late
@marksvids1156
@marksvids1156 Жыл бұрын
@@CodeVault dont worry, all your other videos have helped me a lot for this exam.
@igoriton8371
@igoriton8371 Жыл бұрын
Hello sir. First and foremost, I would like to say that your videos are awsome and really helpful. Secondly, I have a question. Correct me if I'm wrong but, when you try to print what's inside of a pointer, you are dereferencing it, right? So why doesn't the program crash when you try to print env_variable at 1:40 ? I believe it shouldn't even print anything besides "segmentation fault (core dumped)".
@CodeVault
@CodeVault Жыл бұрын
There's no dereferencing inside the main function when I am calling printf. char* env_variable; printf("%s ", env_variable); // derefencing would be if passed *env_variable So, printf gets a pointer and, inside the printf function it probably has a check for NULL so it doesn't dereference the pointer and instead prints out the characters "(null)"
@igoriton8371
@igoriton8371 Жыл бұрын
Thank you for answering my question. Im used to seeing my code crash due to passing empty strings to functions so I got confused. When I try to solve the crashes in the debugger, the SIGSEV signal never appears at the function call, but the fact that you can print an empty string still caught me off guard because I've never seen it. Once again, thank you for the explanation
@ongayijohnian8787
@ongayijohnian8787 10 ай бұрын
Thanks big time 💯
@chamudradamien601
@chamudradamien601 Жыл бұрын
Please do C++ too, class and other stuff only unique to C++
@karimabelkada6417
@karimabelkada6417 Жыл бұрын
comment afficher le statut de retour d’appel de la commande shell
@Patriko30
@Patriko30 6 ай бұрын
how can i implement my own my_getevn function which will will work exactly like this ?
@CodeVault
@CodeVault 5 ай бұрын
You could assign envp to some global variable and simply have the function use that. Since envp is a local variable in main, it will never deallocate before the program ends
@vilijanac
@vilijanac Жыл бұрын
Do you know that Perl language is a higher level C, it should be by default on every system? i.e.: foreach (keys(%ENV)){print $_,"=", "\'".$ENV{$_}."\'", " "}
@CodeVault
@CodeVault Жыл бұрын
I haven't worked with Perl before but I noticed a lot of the Linux libraries use it
@vilijanac
@vilijanac Жыл бұрын
@@CodeVault Yes it is beautiful, works so close with C and libraries. You don't worry about types and memory management, has even own garbage collection, fast but is only an on the go interpreter. On modern computers don't need to worry about that this much as being slower or less efficient. It is better to concentrate on your algorithm, and also find if possible modules already providing what you need, so do not reinvent the wheel.
How to get current time and date in C
10:25
CodeVault
Рет қаралды 14 М.
the cleanest feature in C that you've probably never heard of
8:13
Low Level Learning
Рет қаралды 135 М.
나랑 아빠가 아이스크림 먹을 때
00:15
진영민yeongmin
Рет қаралды 15 МЛН
The Joker kisses Harley Quinn underwater!#Harley Quinn #joker
00:49
Harley Quinn with the Joker
Рет қаралды 42 МЛН
How To Use Shell Environment Variables
15:08
DistroTube
Рет қаралды 33 М.
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 85 М.
Why Function Pointers are Awesome
11:11
Jacob Beningo
Рет қаралды 7 М.
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,1 МЛН
How to execute another program in C (using exec)
14:23
CodeVault
Рет қаралды 105 М.
Linux for Programmers #7 | Environment Variables
12:31
Akamai Developer
Рет қаралды 37 М.
Write Better Code!  |  How to Create Shared Libraries in C/C++
13:59
Low Level Learning
Рет қаралды 55 М.
What are Environment Variables ? with Examples on Windows & Linux
13:22
Compilers, How They Work, And Writing Them From Scratch
23:53
Adam McDaniel
Рет қаралды 173 М.
why do void* pointers even exist?
8:17
Low Level Learning
Рет қаралды 359 М.
나랑 아빠가 아이스크림 먹을 때
00:15
진영민yeongmin
Рет қаралды 15 МЛН