Whats the difference between doing:
typedef struct myStruct {
int a;
int b;
};
and
Type: Posts; User: someprogr
Whats the difference between doing:
typedef struct myStruct {
int a;
int b;
};
and
I'm trying to write a basic function that converts a 6 byte array to a formatted mac address string:
i.e. 0x12 0x13 0x14 0x15 0x16 0x17
would be formatted to:
12:13:14:15:16:17
The code I...
Hello,
I am writing a command prompt program in C but am having issues with the current i/o functions that ANSI C provides. I am currently using gets() and scanf(), but they can't take...
Hello, I have a program that takes input from a user with gets(). Basically, the user is going to input a hexidecimal number. I will need to convert that number to an int because its going to have to...
I have a program which currently calls functions that are located in an array of function pointers. I have to use this method because there are hundreds of functions and which ones to be called can...
if I change myfile.c to:
#include <stdio.h>
extern struct mystruct
{
char a;
char b;
} ab;
Consider the following:
myfile.c
#include <stdio.h>
extern struct mystruct ab;
int main()
Hello, I have 3 header files and 1 .c file.
The .c file #includes both header files.
In the 2 header files, there are extern definitions of of a struct:
header1.h:
#include "types.h"
I have a struct declaration in a header file:
// myheader.h:
struct testStruct
{
char myChar;
int myInt;
char array[200];
testVar is defined in test.c in the main() function as indicated above
char testVar = 'a';
I'm using:
root@c64:/root/testarea# gcc test.c test.h
Hello, I've come across an interesting problem I haven't had before.
Here is an example:
I have a variable called testVar which should be available to any .c file that #includes test.h. For...
Whats the best way to get the current time in milliseconds for C? Time.h seems to have only stuff for hours:minutes:seconds.
I ask because I am trying to emulate a CPU which is significantly...
MK27, Maz:
& wont work because if the 7th bit of val is 1 and we & that with reg which 7ths bit is 0, the resulting value of reg would be 0. I need it to be 1.
| wont work either because if the...
Heres a test program:
#include <stdio.h>
int main()
{
unsigned char reg = 128;
char val = 6;
Hello, I have a very basic question, and this doesn't seem to be working for me:
Heres a test code:
#include <stdio.h>
int main()
{
unsigned char *myptr;
well from my understanding *ptr2 has to point to a char * pointer type and so i pointed it at ptr because thats exactly what it is: a char * pointer.
Same for ptr2... **ptr2 points to a 32-bit...
Hello, I'm writing a program that will be utilizing triple pointers but for some reason my test program isn't working as it should:
#include <stdio.h>
#include <stdlib.h>
int main()
{
...
Hello,
I am in the process of writing functions and such, but I need to know how efficient different algorithms are. Disassembling these functions just tells me the assembly code used, but I...
I'll try that, thanks
I am having difficulty determining whether or not two addresses are on the same page. First let me define a page.
A page is an area in memory that is 255 bytes. The first page (or called zero...
oh ok. thanks
actually, wouldnt shifting it to the right and isolating it be faster? i.e. i = var1 >> 7
I'm trying to optimize my code and I have two bitwise questions:
I have a variable i. I am running a bitwise operation. If var1 = 0, then i = 1, if var1 = any other number, then i = 0. Would this...
ahhhh that did it thanks!