Ah, thanks.
Type: Posts; User: nasser
Ah, thanks.
When I try to do:
access_type > 0 ? modified = 1: modified = 0;
I get the error "Lvalue required as left operand of assignment".
I tried to follow the standard form: (a > b) ? (c = x ) :...
thanks for the link...looks like theres plenty to learn :/
I see, but why would you need a pointer to a function? :s
Couldn't you just create a function prototype for print_data_func and call it like normal??
void search_list(datalist_t *list, int key,
void (*print_data_func)(void*))
{
datalist_t *p;
p = list;
while (p != NULL ) {
if (p->item_key == key ) {
One more question, how can I assign a pointers value into an array i.e
where printArray is a pointer to a char got from a function. This doesn't seem to work:
for(i=0; i<10;i++) {
...
AndrewHunters suggestion worked, thanks.
I tried that, when I do:
printf("\n\nbit_pattern: %s\n\n", bit_pattern[1][1]);
I get: bit_pattern: 01010110011110001001101010111100110111101111, which is basically some combination of the...
Hi
If I have:
char bit_pattern[][4][4] = {
"0000", "0001", "0010", "0011",
"0100", "0101", "0110", "0111",
"1000", "1001", "1010", "1011",
"1100", "1101", "1110", "1111"};
I initialised it like:
char binary[50] = {0} at the start of main. Is this right?
Why won't it be overloaded? I actually tried it and it does.
You defined binary as binary[128], each hex number takes 32 bits/elements, so after a few inputs it will fill up the array.
^Thanks for that.
But can you see I will have the problem where the binary string will be overloaded after a few inputs?
The binary doesn't have to be a character string btw. I want to later...
The problem here is that the character array binary gets overloaded because I am reading in multiple (unknown) number of hex numbers.
I also have the problem of not knowing how many inputs there are...
Hi
I am looking for a way of converting a hex string into binary, or at least somehow separating the bitfields using masking, shift operators or some other method. I came up with a way of manually...
Genius. thank you:)
i've also tried putting "%*c" in front of "%d", but doesn't work for me.
Hi
if I have an input in the form: (character)(number)=(number) i.e a7=5.
How would you put it in scanf form?
I've tried:
scanf("a%d=%d", &getchar, &getnum) == 2
Actually I think I figured it out. I think I'll use a scanf inside an If statement to see if the input is in the form I want. Scanf will return 1 if the input is in correct form, or 0 if its a...
can you explain how that line addresses my problem? how does it work?
i'd prefer someone else answer.
Could you be more specific? Maybe a sample code...
Actually my bad, I changed the question slightly, didn't know it would make a difference.
Say the binary is really a hex number i.e Bi = 1A596317. So they all have 8 bits.
OK, but if you put a...
Hi
I have a particular problem where I need to feed two types of inputs into my program, a hex number and a binary number.
Example of input:
Binary
Bi = 1100100
Bi = 0110101
Bi = 0101100
ok thanks
Determining the instruction type is the easy part, as you just look at the first 6 bits(opcode). I need help with parts 2 and 3.
I have a C assignment where, to summarise, the inputs are assembly instructions(mips) in the form of a hexadecimal number and the program must:
1. determine if the instruction is a "load" or...