Hallo, i have to do a program with gsl library. I have to declare twoglobal array cos i can't pass them to gsl functions. The problem is thesize is an input from program. What can i do? I want to try it:/* Declaration global variables */ int elementi ; gsl_vector_complex*s_v= gsl_vector_com...
Could someone tell me a beautiful way to exit from a switch and a loop in one statementwithout using a goto and if possible without using an auxiliary variable as i didint res;while (1){res = 0;if ((i = msgrcv (msqid, &rq_resa, SZ_MsgSrcResa, pid(), 0) == -1){aff_erreurs ("msgrcv", "Error when r...
In a C program I am required to enter three numbers (integers) e.g. 2567 5 on execution of the program.C:\256 7 5There should be spaces between the three numbers and on pressing"enter", further processing is done. The problem requires me to checkwhether three numbers have actually been entered i...
Hi all !!I need to know that in C how to implement sizeof() without using thekeyword?The implementation should be generic.e.gmalloc(sizeof(struct));Here the sizeof() returns the number of bytes reserved and is areserved keyword which calls a function through the library function.But i want to im...
I am trying to make a function to reverse a string. What I have rightnow ends in a segfault.#include <string.h>#include <stdio.h>/* Reverse a string */void strev(char *s){char tmp;int f = 0;int l = strlen(s) - 1;while (f < l){tmp = s[f];s[f] = s[l];s[l] = tmp;f++;l--;};return;}int...
I am writing a multithreaded web-server and multithreaded client in C.The server is required to keep a log of the transactions in a localfile. I try to open a file using the following:FILE *fd;fd = fopen("file.log","w");fprintf(fd, "%s\n",<a character string>);This is done a by a thread in...
I'm writing a command prompt for unix and I've run into some problems:#include <stdio.h>#include <string.h>#include <unistd.h>#include <sys/types.h>#include <sys/wait.h>#include <stdlib.h>#define EXIT "exit"#define DELIMITER " "we are inint main(argc...
...
Hello all,I've thought about having to implement 2 functions, sayenter_main_loop(func_name); and a function called quit_application();which terminates the program. The enter_main_loop() can be defined assomething like:int enter_main_loop(func_name){while(1){func_name();}return 0;}But then h...
Hi all,I am interested in knowing any periodic (montly/weekly) programmingchalleages held on internetDoes anybody know about such sites? Focusshould be on algorithm development and programming skills.For example, I found this ()butseems they have stopped it nowthanks in advance,pravink...
I was asked to submit atleast 5 solutions for the following problem:By Replacing/Adding or deleting only one character from the followingcode snippet, make it print tttttttttttttttttttt (20 times)#include<stdio.h>int main(){int k, j=20;for(k=0;k<j;k--)printf("t);printf("\n");return 0;}I...
I was looking at the source code of linux or open BSD. What I foundthat lots of typedefswere used. For example, consider the offset in a file. It was declaredasoff_t offset;and off_t is typedefed astypedef long off_t;I wanted to know what advantage do we get by typedefs ? Why we did notdeclareof...

