October 22, 2024
Chicago 12, Melborne City, USA

C++

C++ is a general-purpose programming language. Use this tag for questions about/utilizing C++. Do not also tag questions with [c] unless

C++

How to insert data into Doubly Linked List using for loop in C

I made a Doubly Linked List, but instead of manually assigning the values (10, 20, 30) I want to make a for loop and put the data that way to make it efficient. I did it in Singly Linked List but the same is not happening over here and only backward_traversing function works. #include <stdio.h>

Read More
C++

ALSA snd_device_name_hint memory leak?

Is it ok that the following code: #include <alsa/asoundlib.h> int main(void) { void **hints; if (snd_device_name_hint(-1, "pcm", &hints) < 0) { return -1; } if (snd_device_name_free_hint(hints) < 0) { return -1; } if (snd_config_update_free_global() < 0) { return -1; } printf("Ok"); return 0; } exits with 0 and makes Valgrind return "still reachable: 65,368 bytes

Read More
C++

How can I update the symbols list exported from common area for the vendor and other areas of a gki kernel?

I’m developing a module in the common area of the kernel, but from the vendor area (module) I need to access some registering functions in the common area. I saw that the functions from common area can be exported to vendor and other areas through the "android/abi_gki_aarch64" and "android/abi_gki_aarch64.xml". I need most probably to update

Read More
C++

Arrays 2D – Maximum element in each column

In a family, the people are arranged in rows and columns. Male persons in the families are arranged in a row and females are arranged in a column. Find the eldest woman in each column. Write a program to find the maximum element in each column of the matrix. Input Format The input consists of

Read More
C++

How to determine available physical RAM in a RISC-V OS?

I was recently going through the source code for xv6 (https://github.com/mit-pdos/xv6-riscv), when I recently came across this line: (https://github.com/mit-pdos/xv6-riscv/blob/riscv/kernel/memlayout.h) #define PHYSTOP (KERNBASE + 128*1024*1024) combine this with the Makefile of the project (https://github.com/mit-pdos/xv6-riscv/blob/riscv/Makefile): QEMUOPTS = -machine virt -bios none -kernel $K/kernel -m 128M -smp $(CPUS) -nographic This made me realise that they are just hard

Read More
C++

libusb – bmRequestType for sending data to an iPhone

I have some code here which is supposedly sending bytes of data to an iPhone using libusb, here’s the offending snippet: libusb_control_transfer(handle, 0x21, 1, 0, 0, buf, 0x800, 1000); This works fine but my question here is regarding the second parameter bmRequestType = 0x21, which according to the documentation represents the "request type field for

Read More