Circuit Negma

C++, C, VB.NET, PCB, Electronics, Circuit Design

string of names that hold up 3 full names of 50 character each.

Posted by Circuit Negma on February 6, 2006


#include <stdio.h>

main()
{
       char names[3][50];      // string of names that hold up 3 full names of 50 character each.
       int i;
       char string[50] = “please enter name [%d]: “;
      
      
       for (i = 0; i < 3; i++)
       {
            printf(“please enter name [%d]: “,i+1);
            fflush(stdin);
            scanf(“%[^\n]”, names[i]);         // it terminates when the user press enter.
       }
      
       printf(“\n\n”);
      
       for (i = 0; i < 3; i++)
       {
            printf(“the content of the names array are: %s\n”,names[i]);
       }
      
       printf(“\n\n”);
      
       fflush(stdin);
       getchar();

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: