This repository has been archived on 2023-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
VSMechatronics/LC21/GetThem/getthem.c
2022-11-22 11:56:38 +00:00

25 lines
489 B
C

#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int age;
char name[10];
/* we check the argument count is 3 ( prog name plus 2 params ) */
if ( argc != 3 )
{
printf ("\nProgram use %s name age ",argv[0]);
exit (0);
}
/* Copy the command parameters into suitable variables */
sscanf(argv[1],"%s",name);
sscanf(argv[2],"%d",&age);
/* And display for all to see */
printf ("\nHello %s, you are %d ",name,age);
return 0;
}