I'm currently self-studying C for mastering an university project. In that project we have several signatures given that we need to implement for solving our task. After several hours of trying to make some progress, I must admit that I'm totally confused about the return types of functions. I will show you some code:
This is a structur...
For example, suppose I have a buffer called char journal_name[25] which I use to store the journal name. Now suppose a few lines later in the code I want to store someone's name into a buffer. Should I go char person_name[25] or just reuse the journal_name[25]?
The trouble is that everyone who reads the code (and me too after a few week...
Suppose I have an array of pointers to char in C:
char *data[5] = { "boda", "cydo", "washington", "dc", "obama" };
And I wish to sort this array using qsort:
qsort(data, 5, sizeof(char *), compare_function);
I am unable to come up with the compare function. For some reason this doesn't work:
int compare_function(const void *name1,...
I have this union:
typedef union Message
{
message_base base;
message_with_parameters parameters;
reply_message reply;
buffer_t *buffer; // can't figure out what to put here
} message;
message_with_parameters has a message_base as the first field and reply_message has a message_wit...
It's been awhile since I've played with c, and now I find something I've never seen before:
printf("%-16llu", my_var);
It would seem to be saying print 16 characters of a long unsigned int. But, what's the second 'l' for? long long?
...
Hi,
I am beginner for programming.I referred books of C programming,but i am confused.
1.) What's the difference betweent printf and gets?
I believe gets is simpler and doesn't have any formats?
...
How to get stored the value entered by user in multidimensional array
...
I want to know the ordering of functions in a given source file (and ultimately which header files they correspond to), for purposes of knowing the ordering of lib includes.
Is there a "canonical" automated way (i.e. not trial and error) to get this info?
I'm good with sed/awk hacks but is there a "better way"?
...
I've have a 5 digit integer say,
int num = 23456
how to find the sum of the digits.???
...
I am following the instructions here for cross-compiling GCC. I am on a mac. When I run this command from the gcc source folder: ./configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --without-headers --enable-languages=c,ada,c++,fortran,java,objc,obj-c++,treelang I get this error: configure: error: GMP 4.1 and MPFR 2.2.1...
this is probably a simple solution I am not that familiar with C just trying to port my java data structure assignments to C.
this is the error i am getting:
test.c:4: error: expected ‘)’ before ‘*’ token
test.c:11: error: expected ‘)’ before ‘*’ token
#include <stdio.h>
#include <stdlib.h>
void to_screen(NODE *cur){
while(cur->...
I am working on a GUI application that will be used to perform "manual assessment" of large datasets produced by an AI algorithm. The nature of the assessment isn't important to this question; only the fact that the program will need to periodically check for new data from a server, download it, and then upload the results that the user ...
How do I get the option -10 from command line arguments- "tail -10". getopt function finds '1' character. But how do I access the string "10"?
If this can be done by getopt_long, an example would help. Thanks.
...
Warning: Please treat me like the rookie I am. This is my first "real" C program. So if I don't understand some things, that's why.
I'm trying to make a chat server following the example from Beej's Guide to Network Programming. It came recommended, so there you go.
I want to have a function accept a pointer to a structure, modify prop...
My application has a static control which inside has a tab control. It looks like this:
and I want to handle the topbar's paint event so that after it has drawn itself (and its children), have it floodfill to look more like this:
Given that I'v subclassed the topbar and can override any of its events, how could I do this?
Thanks
...
This is a program like Screensaver.
How to Make fullscreen & colouring of the program output?
and automatic exit program on mouse move?
#include<windows.h>
#include<stdio.h>
#include<time.h>
#include<math.h>
struct tm *local(){
time_t t;
t = time(NULL);
return localtime(&t);
}
const char *ClsName = "BitmapLoading";
cons...
On a server, a process monitors the files in a Unix file system.
If a client sends the file name to be monitored, the server has to send the report to the client whether that file got changed or deleted.
For server-client communication, we should use either message queues or sockets.
For every change in the file, the server has to not...
For code,
while(1)
{
/* ..... */
}
MSVC generates the following warning.
warning C4127: conditional expression is constant
MSDN page for the warning suggests to use for(;;) instead of while(1). I am wondering what advantage for(;;) is giving and why it warns for the constant usage in while?
What flag to use on GCC to get the ...
I executed one program and when I calculated the time elapsed I found that time is not constant. It's varying under some range. I wanted to know why is it so?
...
hi,
so far, i m working on the array with 0th location but m in need to change it from 0 to 1 such that if earlier it started for 0 to n-1 then now it should start form 1 to n. is there any way out to resolve this problem?
...