15,551 Topics
| |
Hello. I am trying to find out how to write a function to replace a string in a text file. So far i got this: find -> is a word i am looking for replace, rep -> new word, f1 -> my file. And i'm stuck with that piece of … | |
Why this piece of code doesnot display array contents #define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0])) int array[] = {23,34,12,17,204,99,16}; int main() { int d; for(d=-1;d <= (TOTAL_ELEMENTS-2);d++) printf("%d\n",array[d+1]); return 0; } | |
So my teacher gave us this file #include <stdio.h> #define MAXVALS 100 /* max number of values we can process */ int tableFill(double a[], int max); void tablePrint(double a[], int num); double tableAverage(double a[], int num); int tableMatchingElements(double a[], int num, double target); int main() { double table[MAXVALS]; /* array … | |
Hi guys can you please help me with this. All I need to do is input a number and display the corresponding alphabet.For example 2 then the output should be A B.. I am working on a code but my problem is the output is displaying together with a special … | |
I am making a text editor in c language and have been stucked with code of go to line number,selecting a text,copying a text,cut text and pasting a text... so please any one can help me out of this as soon as possible....i have submissions by 1st december.... | |
im trying to make my own Serialization library but I have some problems with the following. I have a package wich I serialize to a t_stream and then I need to serialize the t_stream to a char * again. This is the complete code: typedef struct{ int16_t port; int16_t priority; … | |
#include<stdio.h> #define ROW 5 #define COL 5 int main(){ int array[ROW][COL]; int r=0, c=0; for (r=0; r<ROW; r++){ for (c=0; c<COL; c++) array[c][r] = (c+1)-(r+1); } for (r=0; r<ROW; r++){ for (c=0; c<COL; c++) printf("%5d", array[c][r]); printf("\n"); } printf("\n\n"); system("pause"); return 0; } i need help in this code I … | |
Hi, I seem to be having a problem with my code below, which I would like to be able to use to return 2 values from the result of a quadratic equation operation. The eReturn function takes care of negative square root values. I'm not getting any errors back, just … | |
i want to print myname mynam myna myn my m i have done in numbers but i can't print in string/char my code is i want to print myname mynam myna myn my m i have done in numbers but i can't print in string/char my code is main() { … | |
Does the following code make p as a null pointer static int *p; since `printf("%u",p);` outputs as 0 though the syntax is `int *p=NULL or int *p=0` | |
Find the number of sequences in an integer array. A sequence is a list of numbers that comes in strict numerical order like [3, 4, 5, 6]. Sample Input : [1, 2, 3, 6, 8, 10, 11, 15, 16, 17] Sample Output : 3 sequences Any one can hlp please? … | |
Hi all, Im trying to write a program that minimizes a Transition Graph (its basically combining states with similar numbers). Basically, the algorithm is to first find states with the same 'a' and 'b' inputs, combine them, remove them from the 'leftovers' list, then find states that have either 'a' … | |
I am making a text editor in c language.I need a help for moving characters left,right,up and down.I am using turbo c compiler and i want code for navigation and not an ascii key codes.... please help me with this as soon as possible.... | |
pleas help me Write an algorithm to add and multiply two large integers, which cannot be represented by built-in types. | |
hello i was trying to do one of my assignments but i got stuck at sorting my strut arrays elements by alphabetical order. here is the code that i have dose so far but after this even reading as much as i can, i can not get to go any … | |
I am trying read CSV files in a C program on an AIX system. I am having problems getting fscanf to recognize the comma delimeter. I have read previous posts on this issue, and used the techniques dicussed in those threads, but I am still having the issue. Specifically, this … | |
I have two files which goes like this : FILE A is : J5 J15 J25 J30 J35 and FILE B is: J0 23 56 J5 24 58 J10 26 60 J15 29 63 J20 31 36 J25 23 32 J30 51 14 J35 34 21 J40 46 12 The … | |
Hello All, I have a small doubt w.r.t using mutex locks. Say we have a thread-safe function: int counter; void foo() { LOCK_MUTEX(); // say by pthread_mutex_lock ++counter; UNLOCK_MUTEX(); } Now, i understand that this is thread safe because only one thread can "own" a mutex at a time and … | |
| Hi guys, This is not related to syntax or runtime problem. What I am going ask is more about how Linux and Windows handle writing data from buffer to a file. I have this code here, wrapped around a timing block, to write a buffer to a file. StartCounter(); if(rows … |
Having a small a problem with an array value here is the code:i want the array(totalwin) to store the value of the calulation each time it repeats say 10 times.I tried using the for loop but the values are not stored in the array what am i doing wrong. // … | |
Hello there people. I am pretty new in C and programming in general. I was trying to make a password checking programme and I seem to be stuck. int main (void) {char ch; while ((ch=getchar()) != EOF){ This is the beginning of my code and whenever I try to type … | |
#include<stdio.h> int myatoi(const char *string); int main(int argc, char* argv[]) { printf("\n%d\n", myatoi("1998")); getch(); return(0); } int myatoi(const char* string) { int value = 0; if (string) { while (*string && (*string <= '9' && *string >= '0')) { value = (value * 10) + (*string - '0'); string++; } … | |
Given an array A of n integers, give an eficient algorithm to check whether there are two numbers in A whose sum is zero. [ | |
Alright so im supposed to represent an airline. total # of seats is 10. Passangers can choose whether to sit in first or economy. This is what i have so far. If you try the program and try to go from first to economy you will see that it skips … | |
[CODE]#include <conio.h> #include <graphics.h> #include <stdlib.h> #include <stdio.h> void main (int) { int gdriver=DETECT,gmode,errorcode; //Requesting auto-detection. int midx,midy,x; //Initializing graphics and local variables. initgraph(&gdriver,&gmode,"d:\\bc3\\bgi"); //Reading result of initialization. errorcode=graphresult(); if(errorcode!=grOk) //An error occurred. { printf("Graphics error occurred : %s \n",grapherrormsg(errorcode)); printf("Press any key to stop : "); getch(); exit(1); //Terminate … | |
Write a code snippet to declare and accept an integer and calculate the cube value of the integer. The integer should be passed by reference to a function cube(). The function would calculate the result of cubing the integer. The function prototype to be used is: void cube (int *p); … | |
1) The & symbol in C returns the address of a variable. 2) In the expression, `printf(ā%dā, (ans > val)? z : w);` displays the value of w if the condition is true. 3) In the expression, `for( ; a>b; )` A semicolon on its own indicates a null statement. … | |
Write a code snippet to declare and accept an integer and calculate the cube value of the integer. The integer should be passed by reference to a function cube(). The function would calculate the result of cubing the integer. The function prototype to be used is: void cube (int *p); … | |
I'm able to import the file and read it, but I don't think it's saving to the structure. I want to figure out how to save it within the structure so I can search/ delete the contacts. The unfortunately lengthy code is below: #include <stdio.h> #include <string.h> #include <stdlib.h> #include … |
The End.