Dhruv
anyone have c languages array examples .
alessandro
int a[10];
tim
int a[11];
01001000001001100101
Anyone knows a reference to read or watch in youtube really good for beginners in c++
Konstantin
If you beginner you should code. Not watch. So leetcode + google / cppreference is ok for half a year at least.
01001000001001100101
Nice, thank you for the tip🤜🤛
/
Because we are not keen on seeing your photos
Help is it possible to create a program that starts when booting a usb in c or c++
/
i mean in a bootable usb what is the file which contains the first code to be executed
/
for example in the windows installation usb how does the bios know what is the file that contains the code
/
in its root there are three directories boot, efi, sources, support and four files autorun.inf, bootmgr, bootmgr.efi, setup.exe
Pavel
i mean in a bootable usb what is the file which contains the first code to be executed
I'm not an expert in this topic, but I think what you look for is bootloader https://wiki.osdev.org/Rolling_Your_Own_Bootloader
/
i have found this Once the bootable device is found, the BIOS loads the bootloader
Emirhan
I transferred the product members to a file with Class Product. Now I want to delete a product I want from here and its values.
Pavel
how do the bios know the path of the file
I think it's always the first 512 bytes of the sector of the disk that are being read and executed
/
I think it's always the first 512 bytes of the sector of the disk that are being read and executed
in MBR there are something like 400 bytes that contain a program called MBP if i remember well
/
I think it's always the first 512 bytes of the sector of the disk that are being read and executed
The first 446 bytes contain the MBP (Master Boot Program), started by the BIOS using a 19H interrupt. It scans the partitions and run the bootloader that should be runned.
/
and how does it know which is the bootloader that should be runned
Pavel
and how does it know which is the bootloader that should be runned
If I understand correctly you load your code there and your code decides what to run next, so you can probably just hardcode where to look for the next part. Again, I'm not an expert, I think the wiki that I linked above contains a lot of info regarding that
/
iwait
/
If I understand correctly you load your code there and your code decides what to run next, so you can probably just hardcode where to look for the next part. Again, I'm not an expert, I think the wiki that I linked above contains a lot of info regarding that
Bootloaders are generally stored in the first sector of a bootable device called Master Boot Record. So, whenever the BIOS finds the bootable device, BIOS simply reads the data present in the first sector.
Mandelbröt
hello everyone i have a doubt regarding associativity of function call in c++ (precedence) lets say we have : return countBT(h-1) * (2 *countBT(h-2) + countBT(h-1));
Mandelbröt
hello everyone i have a doubt regarding associativity of function call in c++ (precedence) lets say we have : return countBT(h-1) * (2 *countBT(h-2) + countBT(h-1));
int countBT(int h) { // One tree is possible with height 0 or 1 if (h == 0 || h == 1) return 1; return countBT(h-1) * (2 *countBT(h-2) + countBT(h-1)); }
/
i have found a good turorial and i am trying to make it in assembly
/
i mean i am trying to create a bootloader and then i need to know how to make it boot from a usb to test it in a real computer
/
but the one i was making is completely binary while the windows one is in EFI format
/
i dont know if i can use a pure binary directly
CX2F
int a[10];
auto b[20];
Dm
auto b[20];
It's a big difference between auto in C and C++*
CX2F
It's a big difference between auto in C and C++*
Yeah its not in c. C++11 and 17. You can use auto and curly braces for initializers
CX2F
Although I tend to shy away from C.
CX2F
You can use auto in C
Hmm I never tried.
Dm
Hmm I never tried.
They what I mean when I told you about differences. First of all C has nothing similar to templates so auto could work in the same way as it do in C++
Dm
Do you have to use a specific flag when compiling?
No. Auto in C mean automatic (local) lifetime
Dm
So this could be legal: auto int a;
CX2F
No. Auto in C mean automatic (local) lifetime
OK. Yeah. That's a huge difference. So its just a variable local to that scope?
Dm
Yes, as I know and it doesn't make much sense, so I think that's why noone use it in C.
CX2F
Yes, as I know and it doesn't make much sense, so I think that's why noone use it in C.
Yeah. Lol it doesn't make much sense. I didn't even know till you said something.
Dm
Yeah. Lol it doesn't make much sense. I didn't even know till you said something.
I've just checked stackoverflow and the reason of existing of this keyword is backward compatibility for some ancialent code. 🤷‍♂
Dm
Don't you just hate that? Guessing 89 98 c.
🤷‍♂ I don't work with pure C so I don't care :)
CX2F
🤷‍♂ I don't work with pure C so I don't care :)
Neither do I. Its all procedural which makes your life harder. 😭
CX2F
Aside from structs
Dm
Yeah. I think it would be better to discuss such things in OT chat instead of this.
Mandelbröt
In the long sequence
Anonymous
Just need the precedence of calling of the functions
The order of evaluation of the functions is not guaranteed to be in any specific order. They can be evaluated in any order. The function calls may happen in any order.
Anonymous
auto b[20];
This would be a compiler error.
CX2F
This would be a compiler error.
Even if you create a reference to it? Its still a type. Right?
CX2F
Nvm your right
Anonymous
Even if you create a reference to it? Its still a type. Right?
??? auto b[20] is a compiler error because the compiler can't infer the type of array b in this case because there are no initializers. A simple way to fix it would be to do something like this: auto b[20] = {0};
Mandelbröt
The order of evaluation of the functions is not guaranteed to be in any specific order. They can be evaluated in any order. The function calls may happen in any order.
Ohkay So let's say it the statement is executed as : return f(x-1) * (2*f(x-2) + f(x-1)); Which one will be called first (I am thinking about the precedence of the paranthesis with operators . Does the precedence will apply here as well ???)
Anonymous
Ohkay So let's say it the statement is executed as : return f(x-1) * (2*f(x-2) + f(x-1)); Which one will be called first (I am thinking about the precedence of the paranthesis with operators . Does the precedence will apply here as well ???)
No. Precedence does not dictate the order in which operands are evaluated. In your case, the compiler may evaluate the last f(x-1) first, followed by the first f(x-1) and then evaluate f(x-2). It could do it in a different order as well.
Anonymous
i have found a good turorial and i am trying to make it in assembly
Look at xv6 code and it's commentary. The bootloader for xv6 is a 2 stage boot loader and is pretty simple. It does not support advanced features like chain loading and stuff. The EFI partition is what is used to store bootloaders in modern UEFI machines. UEFI is a modern version of BIOS on steroids but it is backwards compatible. The xv6 bootloader would work on UEFI machines as well. Just understand how it works first and you can ask doubts here if you face any problems
alessandro
auto b[20];
There is a mistake in that sentence..
CX2F
There is a mistake in that sentence..
Yes I know the initializer
John
Hi, new to c++, using windows 11, when I wanted to run my code hello world, it shows me 2 debug config gbd and windows, when I clicked on them, cannot run
John
It shows me the JSON something error
/
Look at xv6 code and it's commentary. The bootloader for xv6 is a 2 stage boot loader and is pretty simple. It does not support advanced features like chain loading and stuff. The EFI partition is what is used to store bootloaders in modern UEFI machines. UEFI is a modern version of BIOS on steroids but it is backwards compatible. The xv6 bootloader would work on UEFI machines as well. Just understand how it works first and you can ask doubts here if you face any problems
i have found a reply that says this BIOS: In that 512 bytes the first 446 bytes contain the boot loader the next 64 bytes the partition table, and the last 2 bytes the identifier. The 446 byte boot loader contains a jump to the "no mans land". GRUB solves this by installing additional code in sectors 1-62 on the hard drive. This area of the drive is more or less "no man's land" between the boot sector and the start of the first partition.
John
What IDE?
Vs code
John
I followed a YouTube channel name Bro Code
John
send error code
launch: program 'enter program name, for example C:\Users\Wilson OneDrive\Documents\C++\a.exe' does not exist