[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

Printing the contents of an array...

I have an array that accepts input from the user:

Element
Name
Power

I need to be able to print (dump) the contents of the array back to the sreen from a function print_pokemon.

Thanks,

mapper
0
mapper
Asked:
mapper
1 Solution
 
BudVVeezerCommented:
to dump it back to the screen, do as follows:

typedef struct
{
int Element;
char Name[30];
int Power;
}Poke;

Poke Name_Of_Array[num_in_array];

print_stuff()
{
int i;

for(i = 0; i < num_in_array; i++)
{
printf("Element %d\n", Name_Of_Array[i].Element);
printf("Name %s\n", Name_Of_Array[i].Name);
printf("Power %d\n", Name_Of_Array[i].Power);
}
}
0
 
mapperAuthor Commented:
Please to let me play with this and I will return shortly.

Thanks,

mapper
0

Featured Post

Become an IT Security Management Expert

In today’s fast-paced, digitally transformed world of business, the need to protect network data and ensure cloud privacy has never been greater. With a B.S. in Network Operations and Security, you can get the credentials it takes to become an IT security management expert.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now