C Programming interview Questions #youtubeshorts #shorts 12 #cprogramming #programming

preview_player
Показать описание
let's break down your code step by step:
int main() {
// Step 1: Allocate memory for a character array of size 5
char *str = (char *)malloc(5 * sizeof(char));
// Step 2: Assign a string literal to the pointer (string assignment)
str = "Hello";
// Step 3: Print the string using printf
printf("%s\n", str);
// Step 4: Free the memory (but there's an issue here)
free(str);
// Step 5: Return 0 to indicate successful execution
return 0;
}
final output will be : Hello
.
#cprogramming #youtubeshorts #india #programming
Рекомендации по теме
join shbcf.ru