15,551 Topics
| |
Greetings, I need to develop an application which allows tree main features: to search a text file line by line and if it finds the text then it prints the whole line, so for example lets say the text file has: abcd efgh and i would run the applications with … | |
#include<stdio.h> int strlen_(const char *string); int strlen_(const char *string) { int length; for(length = 0; *string != '\0'; string++){ length++; } return length; } char *strcat_(char *string1, const char *string2); char *strcat_(char *string1, const char *string2) { char *p = string1; if(string1 == NULL || string2 == NULL) return string1; … | |
Let's say we have the two strings FOOBAR and BFORAO. While not really equal as strings, they contain exactly the same characters and according to my needs, I can treat them as equal. And I will be calling them "equal" from now on to avoid typing again and again long … | |
Hi, only posting here as a last resort since I cannot find anything at all online to help me with my project. Anyways, I'm developing an autonomous mobile robot with colour tracking using a khepera II as my robot and a CMUcam2 turret module as my onboard camera, I had … | |
Hey, I have this simple lab that I'm working on, but I keep getting an error while compiling. Here's the question: **Write a program called lab09.c that -prompts the user for a character and then a string. -REMOVES all occurrences of that character from the string, and -prints the changed … | |
never help with pointer and functions. i want to creat a function what check if "char *test" is inside "char array[1]" int main() { char array[1] = {"one", "two"}; char *test = "one"; check(test, array); } void check(char test, char array[]) { int i; for(i = 0; i <= 1; … | |
A lot of people tell me that my code results in Memory Leaks. Since, I am still in an academic environment, it has not had any drastic result on any projects, but I still want to correct it. I have posted below some C code, please go through the coding … | |
I am working on a project with my friend where we have to update existing version of a game which uses SDL 1.2 to use SDL 2.0 header files and functions. I would like to know what is the standard procedure we follow while updating already existing source code to … | |
**I am trying to write a program that will pring a list of random numbers from 1-100 and store them in an array. and then bubblesort them into ascending order. This is what i have so far but it is giving me a whole different set of ascending numbers after … | |
We just read about Functions and Arrays, and I'm still a little confused on those as well as passing a function by reference and calling it. I've been trying to get help from my online teacher, but he's not entirely helpful on the things that I don't completely understand, and … | |
Hello everyone, This is my first program in C and I have ran into weird issue. I am implementing a simple server & client program in C. From my main() in client I call a send_message() function which I believe binds with server and sends the message to the server … | |
Hi everyone, I'm working on an assignment that takes a record of student ID, student last and first name and their score, using array of pointers, qsort to sort in alphabetical order, typedef structs, malloc and calloc, etc. and the program prompts those records and it is stored in dynamic … | |
Now I'm learning basics of gtk using C. In gtk the declaration of a text box is as follows GtkWidget *gtk_text_new( GtkAdjustment *hadj, GtkAdjustment *vadj ); Here can anyone tell me what is the meaning of hadj and vadj? I mean what type of value we should pass? | |
FILE *finp1 = file.txt -------------- web: add $1,$2,$3 sub $4,$5,$6 end: .word 5 ------------------ for some reason i can not go in my 2nd if statment. i think bc i am not using strtok right ------------------------------------------------code---------------- while(fgets(line, 20, finp1) != NULL) //works { tptr = strtok(line, ":"); //works if(tptr != … | |
Hi, I have added sleep with random timings and printed the values. I am actually expecting the "Blocked in Child" OR "Blocked in Parent" out put when other process sleeps. But it it never printing the statement.(when the process is going to sleep the semaphore is not cleared so i … | |
lets say i there is a file with 2 lines in it. and we going to read from it. only thing we dont how how many spaces there are. for ex " -hello ", " -hello", "-hello", " -hello " file.txt ----------- -hello -hello 29 ----------- i want to skip … | |
Hi, I was working with Luminary lm3s811 board with Stellaris Keil. Initially it worked well..sometime later i tried to run program by changing crystal value which is normally taken as 6Mhz.. When i changed it to 6Mhz/2..it worked..but when i went for 6Mhz/12..something went wrong.. Now i can not program … | |
for some reason it always return 1; lets say char line will have a empty line or not empty line. int main(void) { char line[20]; //user may enter some word or enter nothing in LINE if(empty_line(line) != 0) { //... } } int empty_line(char line[]) { for(i = 0; i … | |
Hey all, Im working on a number guessing game where a user has 10 tries to a guess a number. The program supposed to display user guesses and then the main menu after the game has finished. Im running into a couple of problems. The first one being that for … | |
Hi, I am making an image editing program with C and it will come with OpenCV library files. The problem is the program should be accessible from many different operating systems such as Windows, MacOS, IOS, Android - the point is that we want to avoid re-write same code in … | |
C programming in IOS? Hi, I am implementing an image editing program in C which should work both in Windows, IOS (iDevices). Ths point is that we do not want to re-write same code in Object-C or Xcode. Let's say that we have a C program that is just resizing … | |
I am writing a program in C to build linked lists from scratch. However, I am getting hung-up on trying to build a link list that will automatically sort itself. By this, I mean that the nodes will automatically be placed in the correct location. My current code is putting … | |
I am trying to read a file from an offset till end of file: int i,sizeb=210; char *buffer; //[1024]; FILE *f; f = fopen("myfile", "rb"); printf("Reading file.\n"); fseek(f, sizeb, SEEK_SET); long s = ftell(f); //rewind(f); fread(buffer, s, 1, f); fclose(f); But I never get the right result. Also when I … | |
Hello, I am looking for a code to ask the user to input a string int a function. And explication on what does what. I'll be taking a computer science class next year and I try to do some understand some basics. Thank You for your time. | |
int main() { FILE *dp; char name[15]; char sname[15]; int no; char department[10]; char sex[3]; char city[15]; int age; int phone; int num; dp=fopen("veri.dat","r"); if(dp==NULL) { printf("file couldnt opened\n"); return 1; } printf("enter student number:\n"); scanf("%d",&num); while(!feof(dp)) { fscanf(dp,"%d",&no); if(no==num) { printf("%s%s%d%s%s%s%d%d",name,sname,no,department,sex,city,age,phone); } } fclose(dp); system("pause"); return 0; } I … | |
i want to create array of pointer. "aa" "ab" "ac" i tried many thing but it still give me error. char *table[3] = "aa", "ab", "ac"; or char *table[3]; *table[0] = "aa"; *table[1] = "ab"; *table[2] = "ac"; | |
| My code is this atm: #include <stdlib.h> #include <stdio.h> int main(int argc, char *argv[]){ int a,b,c; int swap; printf("Enter 3 Numbers (# # #):"); scanf("%d %d %d", &a,&b,&c); //does all its computing, to see which one is biggest. return EXIT_SUCCESS; } The result when i run it in eclipse is … |
Hi everybody, When I tryed to compile a C program, compiler gave me error, that I haven't see before. Please tell me what does it mean? and what are the possible reasons, this error occure. blade71(20)% gcc lineholder.c -o lineholder Undefined first referenced symbol in file main /tools/gcc/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/crt1.o ld: fatal: … | |
Hi all.. I wrote a program for this: A C program can represent a real polynomial p(x) of degree n as an array of the real coefficients a_0,a_1,…a_n (a_n≠0). 〖p(x)=a_0+a_1 x+a_2 x〗^2+⋯+a_n x^n Write a program that inputs a polynomial of maximum degree 8 and then evaluates the polynomial at … | |
Is there a difference between keywords and reserved words? Is main() a reserved word? |
The End.