Adak 419 Nearly a Posting Virtuoso

Exercise 1-11. How would you test the word count program? What kinds of input are most
likely to uncover bugs if there are any?
Exercise 1-12. Write a program that prints its input one word per line.

help me wid these questions temme the source code and the logic and the meaning of these questions....

thnx..

1) Have your program read in text from a file, where the word count of an editor, could be used to easily check your program's accuracy.

2) Show me your attempt at 1-12. How would you do it be hand, if you were tasked with that job?

Adak 419 Nearly a Posting Virtuoso

What about using char ch = 'a'; and then ch++; 26 times?

char toCap = 'a';
toCap -= ('a' - 'A');

int integer = 0;
integer += 'a' for lowercase,

Now print it with a %c and with a %d :)

And what would it be to change an integer into uppercase?

Check out toupper() and tolower(), as well.

Adak 419 Nearly a Posting Virtuoso

Just use a different name - con is taken by the system. Doesn't matter how you try to get the program to use that name.

System has first "dibs" on it. ;)

Adak 419 Nearly a Posting Virtuoso

I gave you explicit instructions on how to get started in graphics mode, but you've ignored them, and just now you're posting up some half-baked lines of code with no logic in them, as a "clue". And they're not even from you!

My first "clue" is that you won't have the assignment done by tomorrow, having done such a lousy effort, so far. My second "clue", is that you will not pass your class, because programming involves a lot of work - and you have not shown any.

You have a great resource here, and I was looking forward to working with you on this, but you won't work. I feel like I've been kicking a dead horse here, and I'm tired of it.

Goodbye.

jonsca commented: Yes +2
Ancient Dragon commented: Bravo :) +27
tux4life commented: Agree :) +8
hinduengg commented: Nice one! +4
Adak 419 Nearly a Posting Virtuoso

You have a 1 in the 100's column, a 2 in the 10's column, and a 3 in the 1's column.

So you could look to swap the columns:

1 2 3 
   X
1 3 2
 X
3 1 2
   X
3 2 1
 X
2 3 1
   X
2 1 3

Another way to look at it (less efficient, but simpler in concept perhaps), is to make your set of {1,2,3} into an odometer on a car.

Think of it as having three wheels, and on these odometer wheels, we have only 3 digits that they can show - either 1, 2, or 3.

| 1 | 2 | 3 |

now move the odometer wheels, like the car was running down the road:

| 1 | 2 | 4 | <== can't show a 4, so this wheel becomes a 1
| 1 | 3 | 1 | <== middle wheel is incremented, but we can't have 2 1's
| 1 | 3 | 2 | <== got the next combination

continue incrementing in this way ALWAYS working from the right most "wheel", then the middle wheel, then the left most wheel, just like a real odometer would. Set up your logic, so only the digits one two or three can be valid, and only one of each digit can valid.
This can work out well with recursion or nested for loops. The left wheel is the outermost for loop, the middle wheel is the middle for loop, and the right most wheel is the innermost for loop.

Adak 419 Nearly a Posting Virtuoso

-------------------------------------------


I'm using the very very old one,

Turbo C++ Version 3.0. Borland Int.

I know this turbo is very old but it requires this in our school.. ;'(

so, guys can you help me now and stop arguing about what version I'm using,? I just need an example for my program.. I really need it.. :'( Please?

I'm using the even older, Turbo C/C++ version 1.01 from Borland International, and I have *already* told you exactly where your answers can be found -

***One More Time***:

You already have examples of the programs you need, right in your help files!!

Read my earlier post (not the previous post of mine, but my post before that one). The details of the keystrokes may be different for version 3.0, but the help files will be there. All you have to do is copy and paste into your new program, remove the duplicate include lines and such, and add a small amount of user input.

I am NOT going to make your program for you. Either you get to work and show it, or you will get nothing more from me.

Ancient Dragon commented: Good :) +27
Adak 419 Nearly a Posting Virtuoso

There are two ways to make it work in Windows 7: (I believe, but have not tried)

1) download and install it inside XP Mode (not compatibility mode). Home Edition doesn't support this, I understand.

2) Use something like VMLite to run it inside a virtual machine.

Rather long thread, but success is at the bottom of it:
http://social.technet.microsoft.com/Forums/en-US/w7itproappcompat/thread/a4b43e3e-2c63-4b4d-9b52-46974c0b1f1d

Adak 419 Nearly a Posting Virtuoso

Xaviar, This is a merge sort in C, using malloc'd memory, for both the primary and the index array. It gives no compiler warnings or errors.

In very limited testing it appears to work OK.

I was thinking you could compare your problems with how my program does it, and make your troubleshooting, much easier. You're welcome to use any or all of the code, if you wish.

If MAX is about 200, the numbers appear nicely on one page.

#include <stdio.h>
#include <stdlib.h>
#define MAX 10000

void merge(int A[], int Index[], int l, int m, int r);
void mergesort(int *A, int *Index, int l, int r);
void printIt(int *A);

int main() {
  
  int i;
  int *A, *Index; 

  A = malloc(MAX * sizeof(int));
  Index = malloc(MAX * sizeof(int));

  if(!A || !Index) {
    printf("memory allocation failed - terminating program");
    return 1;
  } 
  for(i = 0; i < MAX; i++) {
    A[i] = rand() % 1000;
    Index[i] = 0;
  }

  printf("\n\n  Unsorted Data\n");  
  printIt(A);
  getchar();

  mergesort(A, Index, 0, MAX-1);
  printf("\n\n Sorted Data\n");
  printIt(A);

  free(A);
  free(Index);
  printf("\n\n\t\t\t     press enter when ready");
  i = getchar(); ++i;
  return 0;
}
void mergesort(int *A, int *Index, int l, int r) {
   int m;
   if (l < r) {
      m = (l + r) /2;
      mergesort(A, Index, l, m);
      mergesort(A, Index, m + 1, r);
      merge(A, Index, l, m, r);
   }
}

/* First, index m in the middle between lo and hi is determined. Then the 
first part of the sequence (from …
Adak 419 Nearly a Posting Virtuoso

The more your program does, and the more efficiently it does it, the higher the percentage of cpu utilitization will be.

That's not a bad thing. Sometimes just a few lines of code will generate 100's of lines of assembly or machine code.

If your program is starting to have longer run-times, and still has high cpu utilitization, then you have a worry to be checked out.

Adak 419 Nearly a Posting Virtuoso

What's your compiler?

Just for giggles, try this:

float a[N] = {0.0};

and you can delete char buff[] because it's never used.

Adak 419 Nearly a Posting Virtuoso

@aianne
I would recommend you scrap that compiler (which supports non-standard header files) and get yourself a new one that supports C99
I would recommend Code::Blocks.

You don't know WTF you're talking about!

Turbo C/C++ has EVERYTHING already laid out for her, in the help file - with example programs of EVERYTHING she has to do, except the square - (which is just draw 4 lines)

All she has to do is use her keyboard, and I gave her the keystrokes even to use, in the Turbo C/C++ IDE, to find what she needs, inside the help file.

I don't know why she is unable or unwilling to do this.

Code::Blocks may be nice, but for this assignment, Turbo C/C++ has all the easy answers.

jephthah commented: lighten up the hostile tone. his suggestion is relevant and politely addressed the larger issue, if not the immediate solution. -1
Adak 419 Nearly a Posting Virtuoso

Hi Nakul,

Try to learn C the right way:

1) It's always int main(), never just main() or void main(), and it always has a return integer (generally always 0).

2) now let's make your program look like a *program* on the forum:

Just click on the [.code] icon, in the advanced edit window (I added a period so it would show what it looks like).

Note: code tags, int main(), return 0, a getchar to hold the console window from closing too fast, AND good 3 space indentation. All add up to a better program and programmer.

The indentation allows programmers to use their experienced eye to spot trouble, much more quickly. You will be doing that, as well, before long.

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main()
{
   int x;
   for (x = 1; x <= 250; x ++)
      printf("x = %d\n", x);

   printf("\n\t\t\t     press enter when ready");
   getchar();  //holds the console window open, if needed
   return 0;
}

Try this version of your program, and see if the problem still exists.

Adak 419 Nearly a Posting Virtuoso

Just main() means whatever the compiler accepts for it's defaults, are used. A return of int may also be the default of the compiler.

int main () with no return should give you an error "function should return a value..."

void main() is an error with the newest standards, AFAIK, but not all compilers are up to that standard, yet. Old compilers will allow it, with no errors or warnings, depending on how old a standard they are built to.

The problem with having no return, is that the OS or calling program, can't tell if the program ran without errors, or not.

int main() with a return int, is always what you want, with 0 being the default "program ran ok" value.

Adak 419 Nearly a Posting Virtuoso

You have codes for all of this and much more, if you have Turbo C! No one has to give you anything. :)

Start up Turbo C/C++, and select "file" and "new". Now click on "File" again, and "save as". Give your file a short 8 character or less name, and be sure to end it with .c and save it with that filename.

Now press Ctrl +F1 to bring up the help index. Type "poly" to see help and an example of making a polygon. Then press alt +F1, to go back to the main menu. Type circle or line, and repeat.

Now what I'd do if I were new to it, is copy each one of these help pages, into your new program, and put them in between
/*
and
*/

so they won't bother the compiler. Do that for each one of these help pages.

Now, they're right there, and you can refer to them all at once, if you want, very quickly.

There is no function to draw a square or box, however. For that you can draw four lines, or perhaps use poly().

There are box drawing char's in the upper part of the ASCII code. Get out your ASCII char. They have both a single line box drawing char, and a double line box drawing char. That includes all 4 corners, which are each different char's, btw.

Drawing figures can be slow and …

Adak 419 Nearly a Posting Virtuoso

For a percent of hits, the equation is:

number of hits / number of guesses

not divided by number of misses. Missing percentage would be:

100 - percent of hits = missing percentage.

And always times 100, if you want to express it that way.

So in your function, you need to only return one value - the percent of hits could be that value.

Instead of using a pointer (did you set that pointer to point to the base of the struct?), you could just assign the struct member, with the return from your function:

with a call like this:

yourStruct.percentHits = calculate_hits(int hitNum, int guessesNum);

And changing 
void calculate_hits(int int) to
float calculate_hits(int int)

Nothing wrong with using a pointer to a struct, but there's nothing wrong with using the return from a function - which is what you describe the function as doing, btw. ;)

Adak 419 Nearly a Posting Virtuoso

Or are you also implying that when using DevC I can't create a variable named clrscr or gotoxy because it's defined in TurboC3?

I was implying nothing of the sort. I said nothing about DevC, you, or any variable you can or can not create.

It was directed at Jay.

Adak 419 Nearly a Posting Virtuoso

it's not a homework .

come on ,, no one want to help me

BA:
I want to help you, but you will also need to understand:

1) Obviously, this is an assignment, of some kind. Which is fine, btw.

2) On forums, post up your info, don't attach it as a zip file. Your document only has a few short lines on it, in total. You should post it up in plain text.

3) You need to post up your start on this code. Even if it's a humble start, you need to post it up, first and then we can get started. We're not people who DO your assignments (well, not usually. Sometimes they're so simple we really have to.). What we do is HELP you to do your program. (doesn't matter if it's an assignment, homework, project, hobby, whatever). We aren't going to do it for you.

So, get busy, and post up what you have. Tell us what compiler you are using, and does it have these functions, like setcolor() or SETCOLOR() ?

Adak 419 Nearly a Posting Virtuoso

WaltP: please don't put words into my posts that aren't there. I'm saying no such thing. My comments were intended for Jay.

Jay, I'd have to change a few things in your program, to make it work, would that be OK with you?

Adak 419 Nearly a Posting Virtuoso

It is? What's it used for? Please verify before replying.

[B]random[/B]   Macro that returns an integer.
 Syntax:
   random(num);
   int random(int num);

Defined in  stdlib.h

 Remarks:
random returns a random number between 0 and (num-1).

random(num) is a macro defined in stdlib.h. Both num and the random number
returned are integers.

 Return Value:
Returns an integer between 0 and (num-1).

 Portability:
A corresponding function exists in Turbo Pascal.

 See Also:
  rand    randomize    srand

 Example:
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>

 /* prints a random number in the range 0 to 99 */
 int main(void)
 {
    randomize();
    printf("Random number in the 0-99 range: %d\n", random (100));
    return 0;
 }

Not every compiler may have this, but some do.

Adak 419 Nearly a Posting Virtuoso

One problem I see is that you're using the word "random" as a variable. Change that name, because "random" is a reserved word in C.

If that doesn't fix it, post back and I'll run your program and see what else looks troublesome.

Adak 419 Nearly a Posting Virtuoso

You could do a search that would be faster, but there is absolutely no need for that, in this game. A sequential search is fine!

Some idea code - untested!

if(gameOn) 
  loop for another player's turn
else
  give congrats and goodbye message and exit this game
  in that function ask them if they want to play again

int gameOn( game array, int numRows, int numCols) {

for(r = 0, gameon = 0; r < numRows; r++) {
  for(c = 0; c < numCols; c++) {
    if(game[r][c] == value of opponents ship) {
       gameon = 1;  //gameon is just an int variable you will declare
       break;  //enemy still has an unsunk ship, so game on!
    }
  }
}

return gameon;

//your calling function should handle gameon == 1, or  gameon == 0
Adak 419 Nearly a Posting Virtuoso

In the case statement, in addition to the error of #2, you have a potential error in case #1.

You are asking calloc to give memory of some number * the size of an int. But you don't want the size of an int, you want the size of an int * (pointer). Those are not always the same!

If you are allocating memory for an array of int's then use sizeof(int), but if you are allocating memory for an array of pointers to int, then use sizeof(int *).

Since you are casting the result to an int *, it should be an int * in the sizeof(), not int.

Adak 419 Nearly a Posting Virtuoso

Why don't you remove all that count_x++ stuff, and all those extraneous variables, and post up the latest version of your code.

That old stuff is hard to wade through.

Adak 419 Nearly a Posting Virtuoso

That IS regular C code - I don't code in C++.

I don't believe it needs it's own function for 3 lines of code. You can do that, of course. I tend to group functions by their functionality. Here, you're doing input - and this is a small part of doing that, so I'd put it together with the rest of the input code.

Adak 419 Nearly a Posting Virtuoso

The count array should be of type int, and it's all very short and sweet.

int i;
int count[26] = {0];  //set all elements of count to 0
char string[54] = {"My favorite poem is The Rhyme of the Ancient Mariner"};

for(i = 0; i < 54; i++)
  count[string[i] - 'a']++;

printf("\n%d", count[0]);  //print out the number of a's (not A's).

I haven't run this code, so it might not be perfect, but it shows the idea as well as I can.

Adak 419 Nearly a Posting Virtuoso

A simple while loop before the char's you want, is all you need.

i = 0;
while(str[i] < 'A')
  ++i;

//get your good input here

//then ignore the rest of the char's.
Adak 419 Nearly a Posting Virtuoso

When you see code that so close to being exactly repetitive, it's time to look for better ways of doing this. ;)

int count_a;
int count_b;
int count_c;
int count_d;
int count_e;
//etc.

Just do a distribution count (aka bin sort), and be done with it. Use an int array of 26 elements, and subtract 'a' from all the char's. Now increment the appropriate element or "bin" in the array:
array[letter-'a']++;

and you're golden. If you want uppercase letters counted as well, then extend the array size, and subtract 'A' from the letter, instead.

And if you have a problem with your program, spell out EXACTLY what that problem is (won't compile, has warning, gives inaccurate results (and an example would be nice of the wrong input and output).

Adak 419 Nearly a Posting Virtuoso

You will find it easiest using fixed lengths for each field, and thus a fixed length for each record. Every item then fits nicely into this struct (where each struct member is a field, and each record is a struct. A simple example:

struct item {
  long  prod_num;
  char name[32];      //char *name - not a fixed width
  char supplier[32];  //not char *supplier
  int in_stock;
  float price;
}

You can now read and write from the file in binary mode, with any record you want, one record at a time. While this is a relatively safe way to work this, recognize that the first disk error you have, may make the entire inventory file, no good.

So, you always have two things: 1) a back up file that is not being written to daily, and 2) a list of all the transactions that have occurred during the day. Using these two things, you can recreate the inventory system, should the main file be damaged.

Always best if your struct is a multiple of 2, and preferably a multiple of 32 or 64.bytes in total.

If you can load all your inventory into memory, do so. That still requires safeguards from things like power outages, etc. Backups are essential!! :)

Adak 419 Nearly a Posting Virtuoso

Check out postfix and polish notation (or is it reverse polish notation?), anyway, they make doing this kind of parsing, rather easy.

Adak 419 Nearly a Posting Virtuoso

You can't run Turbo C graphics on another compiler. I couldn't compile your program in Turbo C, since it was missing a parameter (noted on the line in question, below).

But Turbo C is pretty sweet for doing small assignments and programs. I use it a great deal.

The first program below, is yours, the second one is the help example from Turbo C, itself. Yes, it runs in WindowsXP.

/* This is your code. It will not compile, as is, in Turbo C.
#include<stdio.h>
#include"graphics.h"
#include<stdlib.h>
#include<conio.h>
void main()
{
     int graphdriver=DETECT,graphmode;
     int color,n,m;
     initgraph(&graphdriver,&graphmode);  //missing last paramenter!
     for(n=0;n<10;n++)
     {
                      putpixel(250+n,350,BLUE);
     }
     for(m=0;m<10;m++)
     {
                      int x=getpixel(250+m,350);
                      printf("%d",x);
     }
      getch();
*/
//This is the help file from Turbo C, which runs fine in WindowsXP, //with a default install of Turbo C.
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;

   /* initialize graphics mode */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();

   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);             /* return with error code */
   }

   /* draw a line */
   line(0, 0, getmaxx(), getmaxy());

   /* clean up */
   getch();
   closegraph();
   return 0;
}

i

jephthah commented: no, turbo c is not sweet at all, for anything. it sucks and perpetuates suckiness everywhere its use is forced onto hapless students by incompetent administrators in sloppy Second World programming courses. -1
Adak 419 Nearly a Posting Virtuoso

You have a double linked list. If you want to print another node of that list (another structure's worth of data), then go to that node, and print it.

You don't print a structure, from another structure. Structures just hold data, and are not "Objects" with the ability to print other structures.

You use the dot member operator to access each member of the structure, including printing it.

Adak 419 Nearly a Posting Virtuoso

If what he wants is a LINE editor, then he should follow the functionality you can see in Edlin. That was a terrific suggestion from Ancient Dragon.

As far as editing, I'd definitely want to use a compiler with conio.h or ncurses, which have that getch() feature. Also, the gotoxy(), is there as well (although Windows gives you SetConsoleCursorPosition(), which does the same, but it's a bit clumsier). Couple that with wherex(), and wherey(), and you're off to a good start, imo.

The multi-line editor is the better editor, no doubt. The Edlin type (one line at a time) editor is the much easier one to program, however.

So he needs to decide what he wants.

Adak 419 Nearly a Posting Virtuoso

Wow! Edlin takes me back. Used it in my first computer language, BASIC.

Now I find it hiding in WindowsXP, and still working!!

Adak 419 Nearly a Posting Virtuoso

I found out this is called either a "floodfill" algorithm, or rarely, "minesweeper cascade".

Wikipedia has a nice entry on "floodfill" algo. Google shows both recursive and non-recursive hits for it.

Adak 419 Nearly a Posting Virtuoso

No way should this be your first program!

When you want to dynamically create a 2D array, (using an array of pointers to each row, as is commonly done), the C syntax is:

#include <stdlib.h>   //for malloc

int **A;

//say your # of rows is 10, and the # of columns is 8
*A = malloc(10 * sizeof(int *)); 
//then:
for(int i = 0; i < 8; i++) 
  A[i] = malloc(8 * sizeof(int));  //note no * after int, here

//When you're done, free the memory, in reverse order:
for(i = 0; i < 8; i++)
  free(A[i]);
//then
free(A);

It was maddening, trying to separate the good from the bad, so a lot of the code just went under the delete button.

This is a nice problem, but you're not ready for it. Study up. I won't be posting up a completed program, because there are so many code leeches around.

I just had an encounter with one, (another C forum), regarding a poker program. I thought it was for a poker player, but no - it was just for an assignment. He had no clue about the programming needed, but he was good at asking for help, and taking all the code he could get, of course. Grrrrr!

Adak 419 Nearly a Posting Virtuoso

It looks like somebody knew what they were doing in parts of the program -

and then they went criminally insane ;) ;)

I finally got it to compile, at least.

Adak 419 Nearly a Posting Virtuoso

As it turns out, this is a beautifully recursive algorithm example. Even if I didn't have to do this recursively, I would choose that way for this problem.

Generally, problem solving is easier without things like dynamic memory allocations structures, and recursion. But here, it's just too elegant to not use it.

I just got back, so let me get some stuff put away and run your code and see what's up.

Adak 419 Nearly a Posting Virtuoso

I'll take a look at it in about 2 hours. May use an array instead of a stack, but we'll see.

Adak 419 Nearly a Posting Virtuoso

You should be able to access any drive - hard drive, floppy drive, or cd drive - just by changing the letter of the drive, in your program.

You want to *definitely* use high level stream file functions, not low level non-stream, functions.

Remember that a floppy or CD drive, will have much slower access times, compared to a HD, so you may need to introduce a delay() or a very short sleep(). Just a second or two, should be enough, if it's needed at all.

Adak 419 Nearly a Posting Virtuoso

Then your distro has a version of ansi.sys installed. This was heavily used in the early days of DOS. I used it also.

I'll have to see if I can install it into my WindowsXP system, although Windows does have it's own API for this. I believe it's called SetConsoleTextColor().

Adak 419 Nearly a Posting Virtuoso

C doesn't know anything about a CD drive. Your computer knows about the CD drive, because it has a driver that handles it. C just passes the request along to the operating system, and the operating system passes it along to the driver.

That's why you can't use a device, until you have a driver for it.

Adak 419 Nearly a Posting Virtuoso

Blowfish has been passed up by newer encryption algorithms that are faster and better.

National Institute of Standards recently finished an exhaustive test of all the top encryption programs, and made their selection. Blowfish wasn't even considered good enough to enter the final round.

Google N.I.S, encryption selection, and check out Wikipedia cryptology portal for more info and links. And of course, google "Blowfish" if you're still interested. It is a good program, but not top tier, anymore.

Adak 419 Nearly a Posting Virtuoso

Blowfish has been passed up by newer encryption algorithms that are faster and better. Most notably, by Rijindael. PDF on it is at:

http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf

National Institute of Standards and Technology finished an exhaustive test of all the top encryption programs, and made their selection. Google N.I.S.T, encryption selection, and check out Wikipedia cryptology portal for more info and links. And of course, google "Blowfish" if you're still interested. It is a good program, but not top tier, anymore.

Adak 419 Nearly a Posting Virtuoso

The codes shown above this, require that your system has the ANSI.sys driver loaded. (shades of DOS!)

I don't have it on my WindowsXP, system, so it won't work for me.

If you're working or writing code for a Windows system, I strongly suggest you use the Windows API for this, instead.

Adak 419 Nearly a Posting Virtuoso

look VERY carefully at Target and myaddressbook.name, and you'll see (I believe), one of them has a newline that the other doesn't have. That's what's tripping up strcmp(), and your search.

Adak 419 Nearly a Posting Virtuoso

You need to draw an arc in order to get the (circular), cut-outs that your picture has.

Instead of a triangle with "line, line, line", think NOT a triangle, and "line, arc, line, line, arc, line, and line arc, line".

Once you learn to draw an arc, you'll have no problem getting what you want. Forget the "triangle" drawing - that's not a triangle that you're trying to draw. Do you see how the sides of your image are NOT just straight lines with an arc in the middle. The lines which make up the sides of the image, angle inward near the center.

So each side of your image is a line, arc, line. Not a triangle, by definition.

Adak 419 Nearly a Posting Virtuoso

Wouldn't it make more sense to put each digit of one number, into it's own element of one array, and do the same with the second number, into the second array.

Then, in a loop, starting at the one's (right hand column), start adding, and remember, any sum above nine, has a carry to the left adjacent column.

You can make elegant stacks, and use postfix notation (wikipedia for that), but just two arrays, being added or subtracted into a third, seems very intuitive for addition and subtraction. Can't you just see that picture?

Adak 419 Nearly a Posting Virtuoso

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.

Adak 419 Nearly a Posting Virtuoso

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.

Adak 419 Nearly a Posting Virtuoso

We're not in the "given me code when I ask for it with a half-dozen exclamation points on the end", business.

You must have us confused with some saps who think you deserve everything you ask for, when you ask for it, for free. ;)