I am trying to write a C program where the input from command line argument is in the form 0x1234aabb.
This definitely comes in the program as a char *[].
Now, I want to store this input in the form of char a[]={0x12, 0x34, 0xaa, 0xbb}.
Please help.
If you know the string is always a fixed length (e.g. 10 characters as in your example), then you can split the string into four equal parts each three characters long (two for the digits and one for the terminator), and then use
strtoulon each part. If the argument is less than ten characters, only fill in the relevant parts and keep the other as"00".