C | String | Question 10
#include <stdio.h> void my_toUpper(char* str, int index) { *(str + index) &= ~32; } int main() { char* arr = "geeksquiz"; my_toUpper(arr, 0); my_toUpper(arr, 5); printf("%s", arr); return 0; } |
chevron_right
filter_none
(A) GeeksQuiz
(B) geeksquiz
(C) Compiler dependent
Answer: (C)
Explanation: The memory for the string arr is allocated in the read/write only area of data section. The choice is compiler dependent. In the newer version of compilers, the memory is allocated in the read only section of the data area. So any modification in the string is not possible.
In older version compilers like Turbo-C, modification is possible.
Quiz of this Question
Recommended Posts:
- C | String | Question 3
- C | String | Question 4
- C | String | Question 9
- C | String | Question 8
- C | String | Question 16
- C | String | Question 11
- C | String | Question 5
- C | String | Question 15
- C | String | Question 7
- C | String | Question 6
- C | String | Question 14
- C | String | Question 2
- C | String | Question 12
- C | String | Question 13
- C | String | Question 1



