I have the same professor: I have read the forum:
http://stackoverflow.com/questions/2119558/c-help-understanding-how-to-write-a-function-within-a-function-listmap/2119913#2119913
It is very helpful understanding the concept of the function but I'm not sure if I am using it right...
Here is my code.. Let me know if I am on the right ...
I posted a question a few days ago about a linked list in C. I thought everything was ok then the prof emails us saying that instead of this signature:
int insert_intlist( INTLIST* lst, int n); /* Inserts an int (n) into an intlist from the beginning*/
He accidentally meant:
int insert_intlist( INTLIST** lst, int n); /* Inserts an i...
I'm wondering if anyone knows of a place on the web that I can purchase or download software modules, written in C or C++, for the interaction between microprocessors and other components, like DACs, ADCs, or UARTs. Sort of like a git-hub for embedded C software. Does this place exist?
...
I'm making a trivial text editor (as an exercise) in GTK using Glade, GtkBuilder, and C. I have an edit menu with Cut, Copy, and Paste as well as a GtkTextView for the text. GtkTextView automatically binds the cut/copy/paste sequences for itself (and even provides menu items if you right click). I want to connect the Cut, Copy, and Pa...
Hello,
I am using gcc 4.4.2 on linux
I am just wondering does gcc automatically default to compiling with c99 as its the latest standard?
How can I specify if I want to compile with c89 or c99?
Many thanks for any advice,
...
On linux, I'd like to know what "C" API to call to get the per-cpu stats.
I know about and could read /proc/loadavg from within my app, but this is the system-wide load avarages, not the per-cpu information. I want to tell the individual CPUs or cores apart.
As an example of an application that does this, When I run top and press "1",...
Hi, I have the following warnings during the compilation:
solver.c:24: warning: passing argument 2 of ‘mtrx_multiple’ from incompatible pointer type
mat.h:5: note: expected ‘double *’ but argument is of type ‘double **’
solver.c:30: warning: assignment makes pointer from integer without a cast
solver.c:39: warning: assignment makes poin...
I want to write this to only 1 line:
fprintf(stdout, "RCPT TO: <%s>\r\n", argv[argc-1]);
fprintf(sockfd, "RCPT TO: <%s>\r\n", argv[argc-1]);
so i want to send the same string to stdout and to my open socket. How can I do this?
...
Is it possible to compile program on one platform and link with other ? What does object file contain ? Can we delink an executable to produce object file ?
...
stdout is line-buffered when connected to a terminal, but I remember reading somewhere that reading (at least from stdin) will automatically flush stdout. All C implementations that I have used have done this, but I can't find it in the standard now.
It does make sense that it works that way, otherwise code like this:
printf("Type some...
I'm trying to make a small program (in either C or Visual Basic) to simply connect to a gmail email account. Then a simple if statement which will be if new mail received, label.text = "new mail" etc.
I have spent hours and hours searching and I still can't figure this out without paying for scripts.
Any help on this would be gratefull...
I'm using C for a class project for the first time after first learning C++, so syntax is killing me... Basically, I need to store a string given by a function into a separate variable for later use.
I have an array of chars declared like this
char foo[];
A function that I'm given assigns a bunch of characters into this array (or po...
Given this header , how do I find if the MORE FRAGMENTS field is set or not..
struct sniff_ip {
u_char ip_vhl; /* version << 4 | header length >> 2 */
u_char ip_tos; /* type of service */
u_short ip_len; /* total length */
u_short ip_id; /...
typedef struct {
char name[10];
} A;
A * inst = get_instance_of_A();
char *str = g_strdup ( inst->name );
The last line doesn't compile. I also tried &(inst->name) with no luck.
The error I get is:
Error: char is not a structure type.
I understand that char[] and char * are different types altogether. But shouldn't g_strdup be able ...
Simple question for which I could not find answer on the net. In variadic argument macros, how to find the number of arguments? I am okay with boost preprocessor, if it has the solution.
If it makes a difference, I am trying to convert variable number of macro arguments to boost preprocessor sequence, list, or array for further reproce...
Ok, I'm learning C, and I'm trying to reverse a string in place using pointers. (I know you can use an array, this is more about learning about pointers.)
I keep getting segfaults when trying to run the code below. Gcc seems not to like the *end = *begin; line. Why is that?
especially since my code is nearly identical to the non-evil ...
Hi I am getting this eror:
Undefined symbols:
"_sqlite3_open", referenced from:
_main in ccRlWVer.o
"_sqliite3_close", referenced from:
_main in ccRlWVer.o
"_sqlite3_exec", referenced from:
_main in ccRlWVer.o
"_sqlite3_errmsg", referenced from:
_main in ccRlWVer.o
"_sqlite3_close", referenced from:
...
Hello!
I'm learning C right now and got a bit confused with character arrays - strings.
char name[15]="Fortran";
No problem with this - its an array that can hold (up to?) 15 chars
char name[]="Fortran";
C counts the number of characters for me so I don't have to - neat!
char* name;
Okay. What now? All I know is that this can h...
Does someone please tell us where to find classes or functions that communicate with asynchronous sockets (TCP and UDP) between programs runing on unix and windows?
Thanks for your reply
PS; I have already programs that communicate with synchronous sockets.
...
I want to create a fault log. The fault log should be able to store the last 10 faults.
A fault has 3 piece of information:
1. Number of fault.
2. Fault name.
3. Date time of fault.
How can i do this using structs?
Or should i do it using arrays and if so how?
The fault log is for storage in memory only.
...