Question: Hi, can i get help to debug the following C program? The value is expected like this but it's actually like this Please help!!! If

Hi, can i get help to debug the following C program?Hi, can i get help to debug the following C program? The

The value is expected like this

value is expected like this but it's actually like this Please help!!!

but it's actually like this If it's okay, please provide a little explanations. Thanks a lot The

Please help!!!

If it's okay, please provide a little explanations.

Thanks a lot

The code is here for convenience.

#include  #include  #include  char *names[10]; int num_names = 0; void add_name(char *name) { // Allocate space for a copy of the name names[num_names] = malloc(sizeof(name)); // Copy name to new area in memory strcpy(names[num_names], name); // Add one to num_names num_names++; } void print_names(void) { for (int i = 0; i  

#include #include #include char *names [10]; int num_names = 0; void add_name(char *name) { // Allocate space for a copy of the name names [num_names] = malloc(sizeof(name)); // Copy name to new area in memory strcpy(names [num_names], name); // Add one to num_names num_names++; } void print_names (void) { for (int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!