15,551 Topics
| |
Hi, i would like to calculate the execution time of my program. is there any function available to enable it?? | |
Hello, I am trying to divide my dataset(iris dataset) into training and test sets randomly. My dataset contains 150 patterns. And I need to divide 90 patterns to test set, and the rest to training set. How can I do this? Help me with the C code. Thank you | |
| I got this snippet of code from a larger program I've been writing and I'm stuck. All I'm trying to do is read from a file line by line but I keep picking up the new line character, at least that's what I think it is. #include <stdlib.h> #include <stdio.h> … |
hi i am trying to copy the returned value (not really the returnd pointer but what it points at) from function gets but its not working and when i try to print it or print the str_infile before strcpy function , its not printed out !! i added temp_buff before … | |
main() {--- ---- ---- } main(int a, char **b) {--- --- --- } main can be used in the both the ways in c but if there is no concept of function overloading in c how can the above be achieved. | |
Finding some text and replacing it with new text within a C string can be a little trickier than expected. Here is what I had come up with one day. | |
I am having trouble having redirection working with the ability to hit enter and remain in the same shell. My problem is if user types: ./a.out < foo.txt (where foo.txt contains a command like date) I want to execute that command and exit the shell.However,if the user compiles the code … | |
Assignment 1: Simple Text Editor using C programming in Linux Environment The goal of this assignment is to help you practice c programming. A tutorial on Linux commands and c programming is given at the end of this assignment. Resources/examples of c programming is given in Moodle and further help … | |
I am trying to devise a program to scheduling "events" onto 3 different stages using dynamic programming. I have a start time a finish time and an interval associated with each event. int max1(int x,int y) { if (x>y) { return x; } return y; } int max2(int x, int … | |
I'm very confused about void pointers and this notation here below. I do understand that when you have a void pointer you eventually cast it to some kind of type int, double. What I don't understand is what is happening here : copySize = *(size_t *)((char *)oldptr - SIZE_T_SIZE); copySize … | |
Server code part: void spawn (char* program, char** arg_list) // Executing the clients command { printf("\n\nprogram = %s\narg_list = %s\n\str1=%s!!!\nstr2=%s\n\n",program,arg_list,str1,str2); dup2(s2, STDOUT_FILENO); //Redericting information to socket dup2(s2, STDERR_FILENO); execvp (program, arg_list);abort (); // Executing the clients command - After this, program gets stuck, why? /* if (send(s2, "This works multiple … | |
I think that the main problem on my code is that iam trying to pass a struct through another struct . Is there a problem if i use "->" instead of (*). ? Because it keeps showing me an error that say's : invalid type of argument '->' Iam trying … | |
Hello! I'm new here, and I need some help. :) I am working on a program that has to write and read a binary file. I have to add lectures to it, they look like: **COURSECODE;COURSENAME;MAXAPPLICANTS;ACTUALAPPLICANTS;** I could write that in a file without any problems using `char*`. My question … | |
what is the difference of passing an array to a function like this function(int x[]){ } or like this(int x*){ } what is the difference both ways seem to work | |
My friends are keep telling me "Use debugg idiot !" I found out that for a code over 200 lines is very important. But i want to debug only a specific piece of code. And to review the results of a variable while the code is "executing" . Is this … | |
I am trying to read a structure from a .dat file...the first integer to be read is the no of readings, then there is the data in following structure format struct Oven { int rec_no; int temp; int status; char string[10]; }; below is the method through which I read … | |
I am trying to make a compiler for my project using C but I have a problem on how to store the contents of the text file into an array or something similar so that my program can compiler or analyze my txt (code) file. Here is what I have … | |
Was not sure where to post this, but let this a go. I m on my final year. And I have discovered in myself a passion for programming in C and started learning it but it is all in a beginning stage. I really bored of Java or I just … | |
Is it possible to declare an array with a variable as its index value, so that the user himself/herself can enter the exact number of items required....?? | |
Hi guy, I have been teaching myself how to write C programming code, right now am learning the Round Robin Sheduling algorithm, below is the code that i have managed to write, its the basic but i could do with your help or your direction with how to do the … | |
I'm having issues with some code that I'm writing for a class homework, which is to write a simple shell for linux. I was wandering if anyone knew a way to convert a char* to a char** in a better way that what I am using. Currently I'm accepting in … | |
i have an integrated project to build a robot and direct its path via C language im reallly out of this field ! can u just tell me with an idea of basic functioning ! i know this is a c# forun ! but ill be glad if you can … | |
I am learning about compilers right now and search for a source code in C as my guideline to better understand how it works. I found this online from this link [Click Here](http://www.programmersheaven.com/download/16060/Download.aspx) and the code is quite long. Even there are comments in the code, I still find it … | |
I'm trying to extract the value of the coeffecients and the exponent from a polynomial. I have already succeeded in extracting the coeffients using strtok. I applied the same concept to find the exponent, but I don't know how to use strtok to extract the string AFTER the delimiters or … | |
I am writing a program to divide my entire database (which comprises of words(A-Z) and phonemic definitions of the corresponding word on the same line) into small text files that become manageable if they are to be read by an 8-bit microcontrolling unit. The database is sorted. Right now at … | |
Hi, this code is compiling successfully, but giving "segmentation fault" when I am trying to copy data to shared memory. Please tell me where I am wrong. Thanks a lot............ #include<stdio.h> #include<sys/ipc.h> #include<sys/shm.h> #include<sys/types.h> #include<unistd.h> #include<stdlib.h> #include<errno.h> #include<string.h> int main() { int id=-1, status=-1; char *check=NULL; char *p="you"; const size_t … | |
Hi, When i debug the program using gdb , the gdb is entering the definations of std lib functions (ex: printf, strcpy ect) and other internal functions. Initially the debuger was working fine, i dont have clue when it got changed.I guess some of the flags of gdb might have … | |
**the SJN and the FCFS will not continue to answer the problem...** **when i choose one of the task listed (SJN and FCFS others are not filled) it proceed to inputting value,** **after inputting the data it exitS or stop.. help me to display the answer..** #include<conio.h> #include<stdio.h> #include<math.h> int … | |
# **I am installing OpenCv using these steps:** # Building OpenCV from Source Using CMake, Using the Command Line Create a temporary directory, which we denote as <cmake_binary_dir>, where you want to put the generated Makefiles, project files as well the object files and output binaries. Enter the <cmake_binary_dir> and … | |
in using turbo c++ IDE i got this error in void main() #include<conio.h> #include<stdio.h> #include<math.h> void main(){ input_data1( ); }int input_data1(void) { int input; printf("\n\n**************CPU Scheduling*************\n"); printf("|\tChoose CPU Scheduling:\t\t|\n|\t1. Shortest Job Next\t\t|\n|\t2. First Come First Serve\t|\n|\t3. Round Robin\t\t\t|\n|\t4. All CPU Scheduling.\t\t|\n*****************************************\n"); scanf("%d",&input); return input; } void display() { input_data1(); } |
The End.