so im working on a mid-term exam average program of a class of 10 students. would my code start as follows?

void getnames(char stuname[10][20])
{
 int ctr;

 for(ctr1=0;ctr1<10;ctr1++)
 {
  printf("Enter Name %d ", ctr);
  scanf("%s",stuname[ctr]);
 }

void printnames(char stuname[10][20])
{
 int ctr2;

 for(ctr2=0;ctr2<10;ctr2++)
 {
  printf("%s\n", stuname[ctr2]);
 }

and have getNAME as a global function?
Hope my question makes sense. Im still in the pseudocode phase

While you're getting their name, don't you also want to get their exam score?

Are you going to use parallel arrays student name <==> their score sharing the same index, or what's your plan for that?

I like all the major functions to be up above main(). Easy to refer to, and all together. Only very minor one's are put inside the calling function.

You are passing the arrays by value. The changes made to these arrays will be local to the function.
Pass by pointer or use global variables

commented: Arrays can't be passed by value the way you imply. -2

Arrays are *always* passed by reference. (More accurately, the array is "degraded" (becomes just a pointer), which is then passed by copying, but since a pointer is just an address anyway, it's a pass by reference, via proxy.

That's how C always does pass by reference, btw. When we send a pointer to a function, the pointer that arrives is just a copy of the pointer that was listed in the call. The effect is the same as if the original pointer was sent, so no trouble.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.