Scan more than one string

-1

In C can I scan more than one string as it does with integers?

Type:

scanf("%s %s", pal1, pal2);
    
asked by anonymous 18.09.2017 / 13:27

2 answers

2
#include <stdio.h>

int main(void) {
    char pal1[100], pal2[100];
    scanf("%s %s", pal1, pal2);
    printf("%s - %s", pal1, pal2);
}

See running on ideone . And < strong> Coding Ground . Also put it in GitHub for future reference .

    
18.09.2017 / 15:00
-1

Dude, scanf is from C, In C #: code-snippet-1 "> link

Microsoft's example:

using System;

public class Example
{
   public static void Main()
   {
      Console.Clear();

      DateTime dat = DateTime.Now;

      Console.WriteLine("\nToday is {0:d} at {0:T}.", dat);
      Console.Write("\nPress any key to continue... ");
      Console.ReadLine();
   }
}
// The example displays output like the following:
//     Today is 10/26/2015 at 12:22:22 PM.
//     
//     Press any key to continue...
    
18.09.2017 / 13:37