Medium
Qualify the following code:
char *p;
p = (char *)malloc (5 * sizeof (char));
strncpy (p, «abcde», 5);
Author: Abha AgrawaStatus: PublishedQuestion passed 249 times
Edit
3
Community Evaluations
Paul Desplanque
27/02/2025
« problème sur la taille allouée ». J'ai pas coché cette réponse.
Alors oui effectivement, dans la plupart des cas on voudra de la place en plus (un octet) pour terminer la chaîne avec un zéro. Sauf que c'est une convention et on peut tout à fait vouloir ne pas le faire, et le code présenté est tout à fait compilable.
7
What is the size of a long long in C++?3
Find the sum of all even numbers in an array in C3
Write a C program that calculates the average of two notes.2
Write a C program to calculate the total number of sweets.1
What does the following code refer to: C:\ProgramFiles\QtCreator\text.txt ? 2
Include a .h library in C2
Write a C function to swap two integers.