Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?image text in transcribed

The value is expected like this

image text in transcribed

but it's actually like this image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

How do identities from the world's religions lead to conflicts?

Answered: 1 week ago

Question

3. Maximize (the agreement function).

Answered: 1 week ago