scanf language input string --C

1.C language no string type, there is no string variables. Strings are achieved by an array of characters.

2. The name of the array, which is the address of the first element of the array.

3.scanf ( "", x); The second parameter should be the address, but the array of characters, whether to use & can be.

#include <stdio.h>
 int main () 
{ 
    char A [ 26 is ], B [ 10 ]; 
    Scanf ( " % S% S " , A, B &);      // & B can be written to, although textbooks not 
    the printf ( " A =% S, S% = B " , A, B); 
    System ( " PAUSE " );
     return  0 ; 
}

 Input: abc 123

Output: a = abc, b = 123

Guess you like

Origin www.cnblogs.com/imhuanxi/p/11598510.html