CodeVault
CodeVault
  • 302
  • 7 206 171
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
Переглядів: 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
Local vs global variables in C
Переглядів 17 тис.3 роки тому
Local vs global variables in C
How to use scanf with fgets
Переглядів 32 тис.3 роки тому
How to use scanf with fgets
Progress bars with pure HTML
Переглядів 1,4 тис.3 роки тому
Progress bars with pure HTML
The autocomplete input nobody is using (HTML datalist tag)
Переглядів 2,2 тис.3 роки тому
The autocomplete input nobody is using (HTML datalist tag)
Less Known Input Types in HTML
Переглядів 8253 роки тому
Less Known Input Types in HTML
Form Input Validation in HTML
Переглядів 23 тис.3 роки тому
Form Input Validation in HTML
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)
Why are function pointers useful?
Переглядів 29 тис.3 роки тому
Why are function pointers useful?

КОМЕНТАРІ

  • @arnau7144
    @arnau7144 День тому

    u should put arguments in wait() func. just leave it in NULL.

  • @aleksaleks463
    @aleksaleks463 2 дні тому

    these are really the best videos on C out there. thank you so much!

  • @uygar84
    @uygar84 2 дні тому

    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?

  • @jahoopyjaheepu497
    @jahoopyjaheepu497 2 дні тому

    Best explanation of this topic on the entire internet.

  • @mikmik3965
    @mikmik3965 3 дні тому

    Thank you ,this is exactly what i need for my OS homework and teachers wont tell it at class

  • @finndemoncat9379
    @finndemoncat9379 3 дні тому

    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.

  • @parsasamandi569
    @parsasamandi569 4 дні тому

    Thanks

  • @DunnoWhoIAm546
    @DunnoWhoIAm546 6 днів тому

    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!!!!😄😁😇

  • @michael22nguyen
    @michael22nguyen 7 днів тому

    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. :)

  • @adamthaok5025
    @adamthaok5025 7 днів тому

    saved me from 2 hours of useless lecture

  • @capc0307
    @capc0307 8 днів тому

    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.

  • @callmesep9530
    @callmesep9530 9 днів тому

    Why does my teacher inquire us to use pointers and structs for this. This was ideal thank you

  • @VietPhan-ex3ps
    @VietPhan-ex3ps 9 днів тому

    thank you so much

  • @Andrew-tt2cx
    @Andrew-tt2cx 10 днів тому

    Great video, thanks I subbed after watching this.

  • @akshaja101
    @akshaja101 10 днів тому

    Wonderfully explained. Thank you sir.

  • @alauda_projects
    @alauda_projects 11 днів тому

    Bravo, frate. Super tutorial. Felicitări !

  • @Brad_Script
    @Brad_Script 11 днів тому

    Apparently there's another way of initializing a pthread_mutex: pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; I wonder what the difference is

  • @JamesPetts
    @JamesPetts 12 днів тому

    I approve of cooking pots.

  • @martinschulte3613
    @martinschulte3613 12 днів тому

    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)...

  • @eddiecode100
    @eddiecode100 13 днів тому

    i'm 30 seconds into the video and i already know this guy is about to spit some facts

  • @xfsn_archer75
    @xfsn_archer75 14 днів тому

    Holy shit this blew my mind that you can do it this way. Poahhh well explained good sir

  • @abdulhadialdahan1328
    @abdulhadialdahan1328 14 днів тому

    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 😂

  • @Brad_Script
    @Brad_Script 15 днів тому

    you don't actually need to pass a pointer to a function, just the function name should be enough. At least in c99.

  • @longvunguyen6265
    @longvunguyen6265 15 днів тому

    OMG I love you so much !!! You just saved my life

  • @sergi9405
    @sergi9405 15 днів тому

    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.

  • @FeedScrn
    @FeedScrn 15 днів тому

    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.

  • @samadinizar1244
    @samadinizar1244 15 днів тому

    Welcome back

  • @martinparidon9056
    @martinparidon9056 15 днів тому

    Thank you for this video. It was presented very cleary and understandably.

  • @VasilijeVrbic
    @VasilijeVrbic 16 днів тому

    Great explanation. Cheers!

  • @AndreFerreira-jv3qy
    @AndreFerreira-jv3qy 16 днів тому

    Great video man im learning so much from you thank you!

  • @pedroruiz193
    @pedroruiz193 16 днів тому

    how about calling wait() inside the curly braces for "else", before making n = 6? That way you save the if (id != 0).

  • @coreytodtaylor
    @coreytodtaylor 18 днів тому

    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

  • @benwolio9356
    @benwolio9356 18 днів тому

    great lesson hairline man

  • @almaspernshev7370
    @almaspernshev7370 18 днів тому

    U are GOAT🫡

  • @saularaya2066
    @saularaya2066 20 днів тому

    Piola👍

  • @saularaya2066
    @saularaya2066 20 днів тому

    Piola👍

  • @hazelnut2457
    @hazelnut2457 20 днів тому

    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.

  • @xxMKtooStronk__
    @xxMKtooStronk__ 20 днів тому

    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?

  • @AbyteofAlex
    @AbyteofAlex 21 день тому

    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); }

  • @anwartaleb2608
    @anwartaleb2608 21 день тому

    drari dyal 1337 kanchofkom

  • @alabidavid4674
    @alabidavid4674 21 день тому

    I just thought about the wait() in the if statement: is it necessary?

    • @CodeVault
      @CodeVault 21 день тому

      Yea, of course. You always should wait for the child processes you're creating. Otherwise they remain without a parent process

  • @davidpacho6540
    @davidpacho6540 21 день тому

    22 😅

  • @andreasj.3404
    @andreasj.3404 22 дні тому

    If you are here from 42 👍😉

    • @shenghongzhong
      @shenghongzhong 9 днів тому

      What project were you doing and which circle?

    • @andreasj.3404
      @andreasj.3404 9 днів тому

      ​@@shenghongzhong I finished minishell and now I do philosophers in circle 3 and you

  • @mb59621
    @mb59621 22 дні тому

    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 .

    • @CodeVault
      @CodeVault 21 день тому

      Haven't tried running in Notepad++ in a while... You can always just use the terminal to compile and run the programs that way

    • @mb59621
      @mb59621 21 день тому

      @@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.

  • @sudchmo744
    @sudchmo744 22 дні тому

    Is the function 'wait()' nessecerry after 'kill()' function, If so why do we need 'wait() function' ?

    • @CodeVault
      @CodeVault 21 день тому

      wait() also clears the resources left by the child process (if any)

  • @Etk333
    @Etk333 22 дні тому

    Ty

  • @eylulgunes0289
    @eylulgunes0289 22 дні тому

    youtube's best c narrator 👑👑

  • @ItsD3vil
    @ItsD3vil 23 дні тому

    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.

    • @CodeVault
      @CodeVault 21 день тому

      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

    • @ItsD3vil
      @ItsD3vil 21 день тому

      ​@@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.

    • @CodeVault
      @CodeVault 21 день тому

      @@ItsD3vil I noted it down. Not sure when I will get to it

  • @salmanforester
    @salmanforester 24 дні тому

    Fantastic video to learn such a complex concept.

  • @stevenyeh945
    @stevenyeh945 25 днів тому

    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.