Question
Complete the C function to copy at most n characters
from source starting at start_index into destination, ensuring destination is null-terminated. Assume destination has enough allocated memory. #include #include // For debugging, not strictly needed void safe_copy_substring(char* destination, const char* source, int start_index, int n) {   int source_len = strlen(source);   if (start_index >= source_len) {     destination[0] = '\0'; // Source index out of bounds, return empty string     return;   }   int chars_to_copy = n;   if (start_index + chars_to_copy > source_len) {     chars_to_copy = source_len - start_index;   }   strncpy(destination, _________, chars_to_copy); // Line to complete   destination[chars_to_copy] = '\0'; // Ensure null-termination }Solution
Correct Answer: E (Both source + start_index and &source[start_index] correctly provide a pointer to the starting character of the substring within source.)
Which state has emerged as an overall team champion of the North East Olympic Games 2022?
Who is known as the 'Nightingale of India' from Uttar Pradesh?
Who clinched the gold medal at the Asian Marathon Championships in 2024?
What is the target year for the Open Acreage Licensing Policy (OALP) to achieve its objectives?
How many people have been selected for Padma bhusan award 2023?
Google Maps has launched Street View in India in collaboration with which of the following Companies ?
Which bank was penalized by RBI for offering gifts in the form of paying first-year life insurance premiums on certain deposits and contacting customers...
Who among the following was the first woman chief minister of Uttar Pradesh?
In the Republic Day Parade, 2023 which state’s tableaux has been adjudged the best one?
What is the value of the contract signed by the Ministry of Defence with Advanced Weapon Equipment India Limited (AWEIL) for remote control guns?