- 302
- 7 206 171
CodeVault
Romania
Приєднався 14 січ 2018
How to resize an array in C (Part 1)
Source code can be found here:
code-vault.net/lesson/a985b2dd74cfa127eec967874e001035
===== Support us through our store =====
code-vault.net/shop
===== Check out our website =====
code-vault.net
===== Check out our Discord server =====
discord.code-vault.net
code-vault.net/lesson/a985b2dd74cfa127eec967874e001035
===== Support us through our store =====
code-vault.net/shop
===== Check out our website =====
code-vault.net
===== Check out our Discord server =====
discord.code-vault.net
Переглядів: 1 727
Відео
How to use realloc in C
Переглядів 9 тис.Рік тому
Source code can be found here: code-vault.net/lesson/707793f87fa3afa04fc4b0331f001c94 Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
Convert string to Lowercase in C
Переглядів 2,7 тис.Рік тому
Source code can be found here: code-vault.net/lesson/f9ab933d7e9911fec72f423481001007 Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
How to vertically align to the middle in CSS
Переглядів 4,2 тис.Рік тому
Documentation: phrogz.net/CSS/vertical-align/index.html howtocenterincss.com/ stackoverflow.com/questions/79461/how-can-i-vertically-align-elements-in-a-div Source code can be found here: code-vault.net/lesson/a26301837825aa4e65e309fec0000bea Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
Don't make the same mistake I did!
Переглядів 963Рік тому
Some documentation links: developer.mozilla.org/en-US/docs/Web/CSS/gap developer.mozilla.org/en-US/docs/Glossary/Gutters Source code can be found here: code-vault.net/lesson/ac8f1cdcbd049744d3b710634b000b99 Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
What are variadic functions (va_list) in C?
Переглядів 20 тис.Рік тому
Source code can be found here: code-vault.net/lesson/cc1b9349b69947ffe53059a914001612 Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
Measure execution time in C (for Linux and Windows)
Переглядів 10 тис.Рік тому
Links related to the topic of measuring execution time: stackoverflow.com/a/37920181 learn.microsoft.com/en-us/windows/win32/sysinfo/acquiring-high-resolution-time-stamps?redirectedfrom=MSDN Source code can be found here: code-vault.net/lesson/7475a60f972f545c64ae6e5ab80007af Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server disco...
Format and parse datetime in C
Переглядів 3,8 тис.Рік тому
Source code can be found here: code-vault.net/lesson/242e8f1b0b13ccdba2df01e2ef000f77 Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
How to get current time and date in C
Переглядів 13 тис.Рік тому
Source code can be found here: code-vault.net/lesson/931c1634bae351f1ec660773c5001a5b Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
How to get environment variables in C
Переглядів 9 тис.Рік тому
Source code can be found here: code-vault.net/lesson/ Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
How to generate random strings from a set of characters in C
Переглядів 3 тис.Рік тому
Source code can be found here: code-vault.net/lesson/ Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
How to generate random strings in C
Переглядів 3,7 тис.Рік тому
Source code can be found here: code-vault.net/lesson/fc94674ac35b48369c08eb6283003b0a Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
What does fork() actually return?
Переглядів 4 тис.Рік тому
Source code can be found here: code-vault.net/lesson/c5746b15bc917ba13615a0ec8c0011c1 Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
Post-increment vs pre-increment in C (a++ vs ++a)
Переглядів 15 тис.2 роки тому
Source code can be found here: code-vault.net/lesson/ Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
Global functions in multi-file projects in C
Переглядів 8 тис.2 роки тому
Source code can be found here: code-vault.net/lesson/ys1aqurr3x:1642707892012 Support us through our store code-vault.net/shop Check out our website code-vault.net Check out our Discord server discord.code-vault.net
Sharing functions between files in C
Переглядів 28 тис.2 роки тому
Sharing functions between files in C
Global variables in a multi-file project in C
Переглядів 16 тис.2 роки тому
Global variables in a multi-file project in C
Declaration vs. Definition of functions in C
Переглядів 4,1 тис.2 роки тому
Declaration vs. Definition of functions in C
Declaration vs. Definition of a variable in C
Переглядів 7 тис.2 роки тому
Declaration vs. Definition of a variable in C
How to find a string in an array of strings in C
Переглядів 9 тис.2 роки тому
How to find a string in an array of strings in C
Reading and writing a linked list to a file in C
Переглядів 15 тис.2 роки тому
Reading and writing a linked list to a file in C
The autocomplete input nobody is using (HTML datalist tag)
Переглядів 2,2 тис.3 роки тому
The autocomplete input nobody is using (HTML datalist tag)
The difference between DIV and SPAN
Переглядів 4,5 тис.3 роки тому
The difference between DIV and SPAN
Calling fork multiple times (part 2) (With a practical example)
Переглядів 41 тис.3 роки тому
Calling fork multiple times (part 2) (With a practical example)
u should put arguments in wait() func. just leave it in NULL.
these are really the best videos on C out there. thank you so much!
How come you don't cast the variable "a" to void pointer inside of pthread_create function (line 25 when all the code is ready)? Just like you cast the address of the variable "r" to double void pointer inside of pthread_join function on line 32?
Best explanation of this topic on the entire internet.
Thank you ,this is exactly what i need for my OS homework and teachers wont tell it at class
The example on the video was the exact problem I was facing and how I solved it 🥹 Basically I had a function returning a pointer to another pointer wich already had memory allocated to it. The program would crash at random points because of it. Now I just use strdup on the string and use the void function to modify it. It would be best if the debugger would point out my stupid mistake. I hope it was the issue, I still have to test the program when I am done rewriting it.
Thanks
Thanks so much man I got these type of error soo much that I thought to switch to C++ because it uses <iostream>. Thank you so much, I will subscribe you!!!!😄😁😇
Thank you for the video I definitely learn a lot from you. I think one important thing to mention too is that declaring the malloced int* also needs to happen inside the loop or else you you would pass the same pointer and free would free the value sometimes before other threads can use it. I had the same setup but assigned into an int of a struct and had double freeing issues because of this. Still trying how to figure out a way around this though while passing struct if there are any ideas I am all ears. :)
saved me from 2 hours of useless lecture
Thank you so much. You explained it really well, but I have a question: What if I only want to save the age and gender in variables, but not the name? I tried to use "{ \t\"name\": \"[^\"]+\", \t\"age\": %d, \t\"gender\": \"%c\" }" as PERSON_FORMAT_IN and fscanf_s(file, PERSON_FORMAT_IN, &p2.age, &p2.gender) function, but it doesn't work. I think it has something to do with the "+" symbol. I'm not really sure of that. How would I solve it? Thanks in advance.
Why does my teacher inquire us to use pointers and structs for this. This was ideal thank you
thank you so much
Great video, thanks I subbed after watching this.
Wonderfully explained. Thank you sir.
Bravo, frate. Super tutorial. Felicitări !
Apparently there's another way of initializing a pthread_mutex: pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; I wonder what the difference is
I approve of cooking pots.
This code doesn't look clean to me since you don't handle a possible failure auf execlp... - the program will hang if you substitute "ping" by "pong" (or delete /usr/bin/ping on your system)...
i'm 30 seconds into the video and i already know this guy is about to spit some facts
Holy shit this blew my mind that you can do it this way. Poahhh well explained good sir
This is interesting that every process has a parent save for 0 so I guess 0 is the kernel or something ? I guess I would find out next semester with the dreadful Operating System course 😂
you don't actually need to pass a pointer to a function, just the function name should be enough. At least in c99.
OMG I love you so much !!! You just saved my life
00:00 - Introduction to inter-process communication and the purpose of the video. 01:20 - Explanation of pipes as a method of inter-process communication. 02:40 - Basic syntax and functions for creating pipes in C. 04:15 - Demonstration of creating a pipe in C with a simple example. 06:00 - Discussion of reading from and writing to pipes. 07:30 - Example of parent-child process communication using pipes. 10:00 - Handling errors and closing pipes. 12:00 - Summary and conclusion.
Thank you for the vid.... and showing the syntax. It's such a weird execution flow... not natural at all. I'm still trying to wrap my mind around that.
Welcome back
Thank you for this video. It was presented very cleary and understandably.
Great explanation. Cheers!
Great video man im learning so much from you thank you!
how about calling wait() inside the curly braces for "else", before making n = 6? That way you save the if (id != 0).
Hey! I like your videos! The only thing I suppose was wrong in that one is that your doesn't close the descriptor in case of write or read error and return straight away
great lesson hairline man
U are GOAT🫡
Piola👍
Piola👍
thank you so much for these videos, i literally have an exam in 2 days and my prof makes everything seem so complicated, you literally saved me. i have a question tho, just out of curiosity, are you romanian? you kinda give me that vibe.
I have one question. How make a function which returns a string but not only some dummy string, string with parameters. So how to make a function which have for example one string and one int as parameters and return string which have those two parameters?
If you don't wanna malloc stuff typedef struct s_elements { int *array; int a_index; pthread_mutex_t m1; } t_elements; void *routine(void *elements) { t_elements *new_elements = (t_elements *)(elements); pthread_mutex_lock(&new_elements->m1); printf("%d ", new_elements->array[new_elements->a_index]); new_elements->a_index += 1; pthread_mutex_unlock(&new_elements->m1); return NULL; } int main(void) { pthread_t t[10]; t_elements elements; int primes[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}; elements.array = primes; elements.a_index = 0; pthread_mutex_init(&elements.m1, NULL); for(int i = 0; i < 10; i++) pthread_create(&t[i], NULL, &routine, &elements); for(int i = 0; i < 10; i++) pthread_join(t[i], NULL); pthread_mutex_destroy(&elements.m1); }
drari dyal 1337 kanchofkom
I just thought about the wait() in the if statement: is it necessary?
Yea, of course. You always should wait for the child processes you're creating. Otherwise they remain without a parent process
22 😅
If you are here from 42 👍😉
What project were you doing and which circle?
@@shenghongzhong I finished minishell and now I do philosophers in circle 3 and you
hey dude I am sorry I did not reply to you earlier but this is the problem exactly: So the problem is with files taking some input , the code is let's say : #include<stdio.h> int main() { int d ; printf("Enter age."); scanf("%d",&d); printf("%d",d); return 0; } Now when I run this in the nppexec console following all your instructions, nothing happens , there is just a cursor blinking, so I type something on the keyboard(say 2) and press enter , then it prints : Enter age.2 Why is it not printing the prompt first and then taking input ? In case multiple inputs in the code , what it does is that it takes all the inputs first , then prints the prompt printf statements , skips the scanf statements and gives the output .
Haven't tried running in Notepad++ in a while... You can always just use the terminal to compile and run the programs that way
@@CodeVault it's not a major problem, I come from VS code so I like the integrated terminal . There is this "khaki" theme on notepad++ which I love , but I cannot find a way to replicate it on VS code . No extensions are there. Anyways I shall thank you for cooperation ! Your channel is great.
Is the function 'wait()' nessecerry after 'kill()' function, If so why do we need 'wait() function' ?
wait() also clears the resources left by the child process (if any)
Ty
youtube's best c narrator 👑👑
I find this approach the easiest, yes, but not the most reliable. I wish you had used a union or packed the struct, then dumped it to a file and reloaded it.
There are some videos on the topic, although they don't go into much detail: code-vault.net/lesson/dc7v6ej05a:1603733523111 code-vault.net/lesson/c6fxa8ef2y:1603733523174
@@CodeVault Thanks. I've read them; they are good, but they miss the part about packing the struct. The compiler adds some alignment that differs from one compiler to another. I hope if you make a topic for this in your channel for people to understand more the power of C and what they also can do with it.
@@ItsD3vil I noted it down. Not sure when I will get to it
Fantastic video to learn such a complex concept.
Thanks for the clear instructions and good code example. It's highly recommended for beginners like me to further study how to properly end the thread pool after all tasks finished on ChatGPT.