Question
A C function attempts to copy a substring. #include #include #include char* copy_substring(const char* source, int start_index, int length) { char* dest = (char*)malloc(length + 1); if (dest == NUL
- L return NULL; strncpy(dest, source + start_index, length); dest[length] = '\0'; // Null-terminate return dest; } int main() { const char* original = "Programming"; // Length 11 char* sub = copy_substring(original, 5, 10); // start_index=5, length=10 if (sub) { printf("Substring: %s ", sub); free(sub); } return 0; } What is the most likely issue with copy_substring when called as in main?
More IT Operating System Questions
- A circuit has five branches with four nodes including reference node , then the number of linearly independent mesh equation would be_______
- A page has 2^12-byte size and a logical address is 32 bits. How many bits identify the page number?
- In the dynamic programming solution for Matrix Chain Multiplication, the outermost loop iterates over the len (chain length). What are the correct loop bou...
- A Decision Support System (DSS) is best described as:
- What is 'virtual memory' in the context of operating systems?
- Which OOP principle focuses on showing only essential information and hiding the complex implementation details from the user?
- Which cloud computing service model provides customers with virtualized computing infrastructure — such as virtual machines, storage, and networking — whil...
- In a demand-paged system, the memory access time is 200 ns and the average page-fault service time is 8 ms. For the effective access time not to exceed 400...
- Which of the following statements about a B+ Tree is correct?
- Which of the following best describes a query in a database?
Hey! Ask a query
Please enter email id
The email must be a valid email address.
Please enter Mobile Number
Please enter valid Mobile Number
Please enter your Doubt
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
- 200 Questions with Detailed Solutions
- Section-wise Coverage (GA, English, Quant & Reasoning)