15,551 Topics
| |
Hi, I am trying to do meet these 2 requirements: 1. create a global file containing global variables that can be accessed from multiple places. Need this for multithreading. something like global.c/h to contain global data in particular the mutexes. 2. some list modules that is required from different other … | |
The functions are like that: if I press "ctrl + h" or '*' the system will print to the logs the system time(in module programming with printk.), if I press "ctrl+ p" or '-' the system will print to the logs process list and no mattrer if I press the … | |
Are there any tutorials on defining a variable so that it can be used for any type. Example the following: [CODE]int main() { var myvariable; myvariable="this is a test"; myvariable=3.141592; myvariable=myvariable*myvariable; return 0; }[/CODE] But I don't know how to make it possible to make the above code possible. It … | |
Hey guys, simple question that I don't see anything on in the String.h library and I can't remember from my C class 3 years ago. I have the following declaration: char something[100] = "whatever"; And later in the program I call strncpy. After calling strncpy, at some later point I … | |
Hi, I want to write a log function but I want to implement in the style of fprintf/sprintf style. ie [CODE] fprintf(arg1, template string, template values) write_to_log(template string, some array of ints/double etc to fill the template) [/CODE] I want to implement this variadic function: [CODE] void write_to_log(char template, int … | |
I have this code. I want to update the writes immediately to log file before closing the file (because my program might get hang and I have to exit it by ctrl+c so fclose would never be called). The code is: [CODE] 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 … | |
Hi, In java, we can run a program remotely by doing something like this: [CODE]Runtime.exec("ssh machinename programname")[/CODE] I was wondering whether I can do the same in C using some standard library function call. Also is this possible to get a handle to the remote program's input/output to see its … | |
Hi, I am trying to search for a word I have entered into a list. I could list all entries so far. But I am having a hard time figuring out a function that can search for a particular word on the list. Below are the codes. I commented out … | |
Hi, i understand merge sort & quick sort even i can write the programs but iam unable to understand its complexity. its very easy to derive complexity equations for selection & bubble sort. as the code is little complex & recursive nature i am unable to understand its complexity and … | |
I am supposed to create a chain of N processes, where N is the command line parameter. Each process creates a child process, prints out its own PID and its parent's PID, and then waits for its child to terminate by calling the wait() function. [B]Here is my code:[/B] [code=c] … | |
Hello Friends, I want to writ a program which scan network for Operating system at boot time.plz if any known how to start writing that program in c.reference plz Thank u all | |
So I'm trying to make a program that generates twin prime numbers between 1 and 1000. I think I got it, but I can't stop the looping it goes on forever. Here's my code so far: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int a, c; a=3; … | |
Hi every body i need a code of program that makes a number puzzle. the puzzle has 16 pieces,that move with arrow keys. this is my project! plzzzzzzzzzzz help me!:sad: | |
Hello everybody, I want to overload a function based on an array dimension or pointers. Ex: [CODE] int calc(int a[]); int calc(int a[][]); [/CODE] or [CODE] int calc(int *a); int calc(int **a); [/CODE] *a should be &a but i dont know how to face a reference of a reference so … | |
[CODE] [Davis@localhost UNS]$ gcc U_bc.c [Davis@localhost UNS]$ ./a.out a=d i=100 f=0.000000 sizeof(u)=4 [Davis@localhost UNS]$ cat U_bc.c int main() { union test { char ch; float f; int i; }; //union test u={'a',21,34.65}; gives a warning excess elements union test u={100.23}; printf("a=%c i=%d f=%f\n",u.ch,u.i,u.f); printf("sizeof(u)=%d\n",sizeof(u)); return 0; } [/CODE] in the … | |
hello folks, I have an array of integers and I need to search if there's a combination of 2 numbers that resault a defined sum. No loops or static variable are allowed. Any suggestions? cheers, Elad. | |
The following is output from an unknown command off an old school DEC Ultrix machine. Does Linux have a similar command/tool? Thanks, Kent 1 pend_nonpayment: int(), <pend_nonpayment.c 79> 2 usr_pwd: <> 3 display_error: <> 4 clears: <> 5 paint: <> 6 current_date: <> 7 get_process_date: <> 8 strcpy: <> 9 … | |
I've never written byte variables on my unix shell before, so I don't know if it works or not. I'd been using unsigned ints to get hex numbers as input but I was having trouble with what my input actually was. My friend told me to use byte variables instead … | |
I'm trying to change this program into a doubly linked list but i'm having a difficult time. Please help me out thank you.[CODE]#include <stdio.h> #include <stdlib.h> struct Node { char data; Node *next; Node *prev; }; //typedef struct node Node; typedef Node *NodePtr; void insert( NodePtr *dPtr, int value ); … | |
I am all confused, I don't where to start. This is my first programming class and i need some help please. Write a C program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of 10 dollars) and the machine dispenses this … | |
Hi, I used Enum constant as a case of swict statement and trying to select by using the pointer to the structure , which internally has a union and a enum member. the union member again internally have three structures. even i debugged the code. the value of the variable … | |
Hi all, I am doing a school project. I am using a At89C51ED2 microprocessor and it is connect to a 2-Line LCD panel. My teacher need me to write a program of the digital clock using the timer in the microprocessor. He want me to show the word " clock: … | |
hi all! i have been programming in C for about 4 months now, and i have the very basics down pretty well (functions, pointers, etc etc), and have been doing a lot of console apps, and i was hoping to do a fractals program. i have the algorithm down (at … | |
[CODE] /*dynamically allocating memory in called funcion and freeing in caller*/ char** memall(int ns); #define Max 20 #include<stdio.h> int main() { char **s; int i,ns; printf("no of string you want to store"); scanf("%d",&ns); s=memall(ns); for(i=0;i<ns;i++) printf("addrs =%u and string=%s\n",(s+i),s[i]); for(i=0;i<ns;i++) free(s[i]); free(s); /* s=NULL; for(i=0;i<ns;i++) printf("%s\n",s[i]); *///dont try to access … | |
Hi, I've a multifile program in C and I need to use global variables. I've one header file that is called "global.h" where my global variable is defined. In the other files, there's an include directive to "global.h". At the moment, I'm using my variable in the C files without … | |
:-/AnyWay,, Here is what it is supposed to happen.... [COLOR="Green"]The input is a char array initialized with line of Text,, the program should tokenizes the line with the "strtok" function and should output the line of text in reverse order.... [/COLOR] I need to set up a "strcpy"..... I'm almost … | |
Hi, I have little idea of padding. i read in one of the links that : all character variables gets stored in the memory location that is divided by 1. all short variables gets stored in the memory location that is divided by 2. all int variables gets stored in … | |
I am trying to write a funtion that will return the value of 1 if its string argument is a palindrome. I have started but am unsure if it is correct. Could someone please take a look and point me in the right direction? Thanks [CODE]#include <string.h> Int palindrome (const … | |
Hello. :) This is my first post and it's unfortunately to ask for help. The problem is as follows: [LIST] [*]The user types in how many names they wish to enter. [*]An array must be able to hold this many names. [*]The user then types the names. [*]Any characters over … | |
CAn someone give the C code for this? thanks :) : A prime number is an integer, greater than 1, that is only divisible by 1 and itself. 3, 11, and 43 are examples of prime numbers. Twin primes are a pair of prime numbers which differ by 2. For … |
The End.