Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
/* set variables / array */
char MAC[13];
char first;
char second;
char third;
printf( "Please enter MAC with no colons: " );
/* notice stdin being passed in */
fgets ( MAC, 13, stdin );
printf("%s",MAC);
puts(MAC);
/* first = MAC[0];
second = MAC[1];
third = MAC[2];
puts( first );
puts( second );
puts( third );*/
getchar();
return(0);
The above compiles and runs.
I have tried printf("%s",MAC[1]); to print to screen the 2 character of the array it compiles but then get run error?
In my minfd i want to printf("%s",MAC[7]) and printf("%s",MAC[6]) etc so that to screen is showns character7character6 etc
The MAC input can contain letters or numbers, this why I have stayed with char instead of int.... is this right?