Checkout
checkout
view
Your Cart Your Cart: item(s)
View Details $1.99 Download Add to Cart

gcc c: how do I impliment and reference a 2d array of structs

I am to implement an array that holds a color image. he image has 640x480 pixels. So, I need a 2-d array. Each pixel has 3 colors, red green blue. The values for each color is an integer between 0 and 255. So, I need an array of structs to hold the data. I am having trouble with the struct: typedef struct tnode { int red; int green; int blue; } myimage(640,480); //I have to use the typedef - my interpretation of the above is that is creates a 2 dimensional array of the structure which has integer elements of red, green, and blue// //Further in the program inside a loop I have:// myimage[b][a].red=rand()%256; //The compile says that there is a syntax error before the... click for more

Subject:

Electrical and Computer Engineering

Topic:

Microprocessors and Microcomputers

Posting ID:

12977

OTA ID:

103877

View Details $1.99 Download Add to Cart

C linked list manipulations

I have to insert, delete, print all, and print specific members of a linked list. typedef struct tnode { int wayptnum; double x; double y; double heading; double distance; struct tnode *next; }gpsnode; That is my link list struct definition. I want to include a next that indicates the location of the next record. Why does this have to be so elaborate? Since the next entry is a pointer - doesn't that mean it is just an integer value of a memory location. So, why not have int next instead? while ( fscan(fileptr,"%c%i%d%d",cmd,wayp... click for more

Subject:

Electrical and Computer Engineering

Topic:

Microprocessors and Microcomputers

Posting ID:

14135

OTA ID:

103906

View Details $1.99 Download Add to Cart

sorting out C linked list/pointer errors

This is a program to insert, delete, print, printall to a list of waypoints using linked lists and pointers in C. My biggest problem is prototyping a function that has a cast that be will typedefined in Main... how do I do it? I've resorted to trial and error to try and find the correct syntax but that's gotten me anywhere. Please point out any obvious syntatical errors in the code. Insert() is not finished and I am having conceptual troubles with delete(). I'd like to get the bugs worked out thusfar before I finish insert and do the delete routine. Thank you. --- // // #include #include #include //dummy macros until I can get the re... click for more

Subject:

Electrical and Computer Engineering

Topic:

Microprocessors and Microcomputers

Posting ID:

14237

OTA ID:

103906

View Details $1.99 Download Add to Cart

linked list program -> data is not being read in correctly?

(the program is supposed to insert, delete, print, and print all members of a link list) Please help me sort this out. This is my program which is supposed to read from a file: command, waypoint number, x coord, y coord. It calls a function based on the incoming command. The program compiles and runs without a formal error. However, it hangs on the prnt function. My data is not being read in correctly. If the data is not being read in correctly, then it would account for junk piling up in the list. (incorrect pointer use?) and/or My data is either not being stored or referenced correctly in the linked lists. (incorrect pointer use?) Please tell me where the problem is... click for more

Subject:

Electrical and Computer Engineering

Topic:

Microprocessors and Microcomputers

Posting ID:

14337

OTA ID:

103906

View Details $1.99 Download Add to Cart

Please help debug

I just included the relavent portions of the program. My errors seem to be in my enqueue function. The errors are syntactical. I need a second set of eyes to determine where the errors are. Two parse errors and two data misrepresentations... Thank you! typedef struct Data /*struct*/ { unsigned char byte; struct Data *next; }data; . . . int enqueue(data **head, data **tail, unsigned char data) { /*This adds the data byte to the que.*/ data *hold,*new; /*Placeholders*/ if(*head==NULL) /*If que is empty.*/ { new=(data *) malloc(sizeof(data)); if(new==NULL) /*if no memory allocated.*/ { printf("No Memory Allocated, enqueue.... click for more

Subject:

Electrical and Computer Engineering

Topic:

Microprocessors and Microcomputers

Posting ID:

16269

OTA ID:

103642

Page generated in 0.0113 seconds

About Us ·  Contact Us ·  Samples ·  Solutions ·  Legal Terms and Conditions ·  Privacy Policy

©2008 SolutionLibrary.com

Search for Solutions About Us Samples