please dont rip this site

Language Ccpp Cref Examples Switch.c

/ **************************************************************************
 *
 * Purpose: Program to demonstrate the 'switch/case' structure.
 * Method:  Prog looks at the number of parameters passed to it and 
 *          tells the user how many its got.
 * Author:  M J Leslie
 * Date:    09-Apr-94
 *
 **************************************************************************/

main(int argc, char *argv[])
{

  switch (argc)			/* Switch evaluates an expression (argc)  */
  {
				/* If expression resolves to 1, jump here */
  case 1:
    puts("Only the command was entered.");
    break;		        /* break - cases the execution to jump
				   out of the 'switch' block.             */
   
				/* If expression resolves to 2, jump here */
  case 2:
    puts("Command plus one parm entered");
    break;
   
				/* If expression resolves to 3, jump here */
  case 3:
    puts("Command plus two parm entered");
    break;

				/* Any other value jumps here.            */
  default:
    printf("Command plus %d parms entered\n", argc-1);
    break;
  }
}


file: /Techref/language/ccpp/cref/EXAMPLES/switch.c, 1KB, , updated: 1997/4/21 09:52, local time: 2024/4/19 12:04,
TOP NEW HELP FIND: 
3.149.24.159:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.piclist.com/techref/language/ccpp/cref/EXAMPLES/switch.c"> language ccpp cref EXAMPLES switch</A>

Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .