Шукаєте відповіді та рішення тестів для LP25 Système d'exploitation Linux et programmation système en langage C? Перегляньте нашу велику колекцію перевірених відповідей для LP25 Système d'exploitation Linux et programmation système en langage C в moodle.utbm.fr.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
Observez le code ci dessous :
char *f(char *s) {
while (*s != ',')
++s;
return s;
}
Quelles sources de problèmes existent dans ce code (2 réponses correctes) ?
Observez le code ci-dessous :
#define MAX_LEN 4096
/*!
* @brief function make_path concatenates a dirname and a filename to provide a full path to file
* @param path_to string containing the directory of the file (NULL if file is in current dir)
* @param file_name the file basename (shall not be NULL)
* @return a pointer to the full path, allocated by the function and freed by its caller.
*/
char *make_path(char *path_to, char *file_name) {
char *full_path = malloc(sizeof(char) * MAX_LEN);
if (!path_to) {
strcpy(full_path, file_name);
return full_path;
}
if (!file_name)
return NULL;
strcpy(full_path, path_to);
strcat(full_path, "/");
strcat(full_path, file_name);
return full_path;
}
Que va-t-il se passer si la fonction est appelée avec path_to ayant une valeur et file_name étant NULL ?