Jul 20, 2012 #1 S ste2006 Advanced Member level 4 Joined May 1, 2012 Messages 118 Helped 3 Reputation 6 Reaction score 3 Trophy points 1,298 Activity points 2,226 Anyone any ideas how to pass a single bit (flag) to a function in C. I want to pass in one flag and then return another. I know i can create a struct and access individual bits in my main program but what about functions?? Any ideas or will i have to pass a char and modify the bits with AND, OR Functions. (Was hoping to avoid this as it gets confusing to debug) Thanks,
Anyone any ideas how to pass a single bit (flag) to a function in C. I want to pass in one flag and then return another. I know i can create a struct and access individual bits in my main program but what about functions?? Any ideas or will i have to pass a char and modify the bits with AND, OR Functions. (Was hoping to avoid this as it gets confusing to debug) Thanks,
Jul 21, 2012 #2 S sky_123 Advanced Member level 4 Joined Feb 26, 2011 Messages 1,166 Helped 279 Reputation 566 Reaction score 270 Trophy points 1,363 Activity points 9,606 It is not possible to pass a bit. You need to pass a byte, or a pointer to memory location.
Jul 21, 2012 #3 S ste2006 Advanced Member level 4 Joined May 1, 2012 Messages 118 Helped 3 Reputation 6 Reaction score 3 Trophy points 1,298 Activity points 2,226 Fair enough, I kind of suspected that but said i would ask the question anyway in case, I suppose ill just pass the char in and do bit wise operations on it, Thanks for the response though
Fair enough, I kind of suspected that but said i would ask the question anyway in case, I suppose ill just pass the char in and do bit wise operations on it, Thanks for the response though