Code:#include <stdio.h> #include <string.h> main() { int TMR1H = 12345678; int TMR1L = 12345678; char str1[8]; char str0[8]; str1[0] = TMR1H; str0[0] = TMR1L; char str[16]; strcpy (str, str1); strcat (str, str0); printf("%s", str); getchar(); }
This is my code so far. All I want is to create a variable which consists of TMR1H immediately followed by TMR1L. These two variables contain the first half(L) and second half(H) of a 16 bit binary number. I dont want any arithmetic operations performed on them, simply str = 1234567812345678. Ideally, the output type is an int. At the moment I'm getting some odd characters from the printf function. Im probably doing very silly things here so if anyone can enlighten me I would be very grateful!
Dan



LinkBack URL
About LinkBacks




At least I learned quite a lot! Yeah the whole hex system makes sense to me now, I think im more glad that's been de-mystified than the & operator!