C Programming Tutorial

   main( )                                                     
       char word1[40], word2[40], word3[40], word4[40];        
       printf(\"Enter text : \\n\");                              
       scanf(\"%s %s\", word1, word2);                           
       scanf(\"%s\", word3);                                     
       scanf(\"%s\", word4);                                     
       printf(\"word1 = %s\\nword2 = %s\\n\", word1, word2);       
       printf(\"word3 = %s\\nword4 = %s\\n\", word3, word4);       

   Enter text :                                                
   Oxford Road, London M17ED                                   
   word1 = Oxford                                              
   word2 = Road,                                               
   word3 = London                                              
   word4 = M17ED                                               
   Enter text :                                                
   Oxford-Road, London-M17ED United Kingdom                    
   word1 = Oxford-Road                                         
   word2 = London-M17ED                                        
   word3 = United                                              
   word4 = Kingdom 

Didn't find what you were looking for? Find more on Program to read a series of words from a terminal using scanf function