15,554 Topics

Member Avatar for
Member Avatar for negru

I need help with the following program: Create a structure **STRING** which represents a string ( as singly linked list). Check if the string is a palindrome using stack and function which prototype is **int palindrome(STRING *str);** Code: #include <stdio.h> #include <stdlib.h> typedef struct { char *info; }STRING; typedef struct …

Member Avatar for rubberman
0
1K
Member Avatar for anirbanengg

I am trying to return a pointer from a function and use the return in a different function . But I am getting memory leak. Please help. The test code which I wrote and detected with memory leak by CPPCheck. ######################################################################## # include < stdio.h > # include < malloc.h …

Member Avatar for anirbanengg
0
150
Member Avatar for glao

In order to find the most occurent element I am using: int find( int* arr, int size ) { int count = 0, MostOc; for ( int i = 0; i < size; i++ ) { if ( count == 0 ) { MostOc = arr[i]; } if ( arr[i] …

Member Avatar for glao
0
239
Member Avatar for Hiba.Mohammed

#include<stdio.h> #include<math.h> int factorial( int ); int main() int n; double x,i; double value, sinx; value = sinx = 0.0; printf("Enter the value for x and i"); scanf("%lf %d", &x, &n); for( i=1; i<=n; i=i+2) { value = pow(x,i); sinx += (x - value / factorial(i)); } printf("Result - %f", …

Member Avatar for rproffitt
0
4K
Member Avatar for Hiba.Mohammed

#include<stdio.h> #include<math.h> int factorial( int ); int main() int n; double x,i; double value, sinx; value = sinx = 0.0; printf("Enter the value for x and i"); scanf("%lf %d", &x, &n); for( i=1; i<=n; i=i+2) { value = pow(x,i); sinx += (x - value / factorial(i)); } printf("Result - %f", …

Member Avatar for rproffitt
0
300
Member Avatar for negru

Write a function for swapping players in a team. New player (which is read) enters team and replacing the player which is also read. Prototype of function is void swap(TEAM *, PLAYER, int); First argument of a function is the pointer to team, second argument is the player that enters …

Member Avatar for David W
0
188
Member Avatar for negru

Write a program that reads data from binary file **EMPLOYEE.DAT** (employees are proffesors and teaching assistants, assume that the file exists). Split data about proffesors and teaching assistants in two separate text files and sort data by **ID** using insertion sort algorithm. Search and print data about employee which **ID** …

Member Avatar for David W
0
246
Member Avatar for negru

Write an iterative function **char* conversion(unsigned int num, int base)**, that converts an integer **num** into any **base** **(base <=10)**. How to transform the following recursive function conversion() into iterative: #include <stdio.h> void conversion(unsigned num, unsigned base) { if (num / base) conversion(num / base, base); printf("%u", num % base); …

Member Avatar for David W
0
268
Member Avatar for negru

Write a program that reads strings(words) from a text file and copy the inverted words to another file (use the command line arguments). Form a new array of words b from original array a using the function ***void formNewArray(char **a, char **b, int n, char* (*t)(char *));*** where ***n*** is …

Member Avatar for rubberman
0
207
Member Avatar for ranjini.jayam

Hi Am doing my project in image procesing(text extraction from image)can u anyone send the codings for extract the text from image

Member Avatar for wenbuyi
-1
667
Member Avatar for waseem1345

hello, this is the part of the code I'm having a problem with if(a1==r1a || a2==r1b) {//REPLACING for(p=0;p<8;p++) { for(r=0;r<8;r++) { if( i[p][r]==1) { i[p][r]=0; } if(p==a1 && r==a2) { i[p][r]=1; r1a=p; r1b=r; } } } } I have only 2 units in the board of my chess game, intiger …

0
222
Member Avatar for waseem1345

How do they work? Does -'0' always convert to int from char? Can it convert from anything? And same question about +'0', does it convert only from char to int, or from anything? Thanks in advance :)

Member Avatar for David W
0
8K
Member Avatar for waseem1345

Hello, I'm new to C language, and I'm using Visual C as my compiler.. Here's my code: #include <stdio.h>#include <stdlib.h> #include <Windows.h> int i[8][8]; void main(){ int row; int col; for(row=0;row<=7;row++) { for(col=0;col<=7;col++) { i[row][col]=0; } } printi(); getchar();getchar(); } int printi() { char s[500]; int row; int col; int …

Member Avatar for David W
0
385
Member Avatar for Rimaa21

Hello peopole , i want a program in c that can changes the order of a sentence unsing stack ,please can you help me ???

Member Avatar for David W
0
166
Member Avatar for glao

Hello , I want to compare each element of an array with every other. For example, array[0] with array[1] , with array[2] ... Then , array[1] with array[2],with array[3] ... So , I thought something like this : for ( int i = 0; i < N; i ++ ) …

Member Avatar for tinstaafl
0
566
Member Avatar for Amr.Mohammad87

I've read the following statement and I cannot understand something within it "*In all binary trees, there are at most 2^i nodes at level i + 1*" what I cannot understand is that tree's levels start at level 0, however, if we apply what is written in this statement there …

Member Avatar for Ben McNamara
0
202
Member Avatar for COKEDUDE

I'm not getting the expected result when I do division. Can someone please tell me what I'm doing wrong? int page_list_size = 20; int page_fault_counter = 0; double failure = 0.0; double success = 0.0; failure = page_list_size / page_fault_counter; success = 1 - failure; printf("failure Is %lf\n",failure); printf("success Is …

Member Avatar for rubberman
0
114
Member Avatar for progteacher2

Hello good morning...I need help on how print the heart beside each other here is the code.. #include <stdio.h> #include<stdlib.h> #include<Windows.h> int heart() { int i, j; for(i=10/2; i<=10; i+=2) { for(j=1; j<10-i; j+=2) { printf(" "); } for(j=1; j<=i; j++) { printf("*"); } for(j=1; j<=10-i; j++) { printf(" "); …

Member Avatar for progteacher2
0
175
Member Avatar for COKEDUDE

After you have the appropriate infix to postfix expression how would you do the math with the expression? I'm having difficulty programming it. // Operator supported: +,-,*,/,%,^,(,) // Operands supported: all single character operands #include<stdio.h> #include<conio.h> #include<ctype.h> #define MAX 50 typedef struct stack { int data[MAX]; int top; }stack; int …

Member Avatar for Anu_5
0
244
Member Avatar for progteacher2

Greetings. I would like to ask for help. Our teacher ask us to make these messages move vertically. "Merry Christmas""and" "Happy new year". I just dont know where to start..but my idea is that I will be using the for loop.Would that be possible??

Member Avatar for deceptikon
0
111
Member Avatar for Ghost0s

Hi today i noticed that this program [below] wont print the correct value and it always print 0.00000 #include <stdio.h> #include <stdlib.h> int main() { float S; int n; scanf("%d" , &n); S=1/n; printf ("%f", S); return 0; but when i asked my teacher he said you should make it …

Member Avatar for ddanbe
0
148
Member Avatar for chrisschristou

hello world i would like to know to print on terminal a message with color and backround without external library i find this on internet and it works pretty fine but i would like to coloriza backround too!! #include <stdio.h> #define ANSI_COLOR_RED "\x1b[31m" #define ANSI_COLOR_GREEN "\x1b[32m" #define ANSI_COLOR_YELLOW "\x1b[33m" #define …

Member Avatar for rubberman
0
419
Member Avatar for Damien_3

I have need to find a particular string from a text file. The user inputs the string they're looking for and the program searches through the opened text file to find that string. Is that possible? void exam() { char name[50], rollno[50]; FILE *search; printf("\t\t________________________________"); printf("\n\n\t\t\tPortal Examination"); printf("\n\t\t_______________________________"); printf("\n\tEnter Name …

Member Avatar for tinstaafl
0
212
Member Avatar for Dave Sinkula

Many times [inlinecode]strtok[/inlinecode] is recommended for parsing a string; I don't care for [inlinecode]strtok[/inlinecode]. Why? [list][*]It modifies the incoming string, so it cannot be used with string literals or other constant strings. [*]The identity of the delimiting character is lost. [*]It uses a static buffer while parsing, so it's not …

Member Avatar for anti_neoliberal
0
10K
Member Avatar for can-mohan

Hi All, I am new to thread programing. In below code snippet inside producer thread if return NULL statement is removed i observed programme is hanging. Usually after execution of pthread_cond_signal(&cond); i believe i am out of this thread and consumer thread already have taken proper exit after execution of …

0
129
Member Avatar for trishtren

Hi, I was wondering if anyone could help me or point me in the right direction. Iv been developing a source to source compiler for some time, so one language being translated to C++/C. Now the source has been translated i wish to package a windows and linux c++ compiler …

0
161
Member Avatar for LinuxGuy80

My question may be unclear but, can integer pointers be in any type of data structure? I mean like in a list, tree, graph, etc. Like say a linked list: struct list { struct list *next; int *some_data; }

Member Avatar for rubberman
0
167
Member Avatar for priyanka.choudhary.90038

Hi, I have one doubt in my mind that why below programme ended up in infinite loop if return NULL statement is commented. pthread_cond_signal will take control out of loop and gracefull exit is done from consumer thread . #include <pthread.h> #include <stdio.h> pthread_mutex_t mutex; pthread_cond_t cond; int buffer[100]; int …

Member Avatar for rubberman
1
216
Member Avatar for COKEDUDE

I'm having trouble getting the parameters correct in my cat function. I would think since I'm changing temp that I would need to pass the address since I want to be able to see that in main. I think I'm getting screwed up by the decaying. #include <stdio.h> #include <stdlib.h> …

Member Avatar for rubberman
0
2K
Member Avatar for Ghost0s

hi everybody im a beginner in C and im still confused with pointers so ihave a question if we consider this tiny program int a = 5 int *ptr int nptr whats the difference between those lines [below]?? what happens in memory ?? ptr = a ptr = &a nptr …

Member Avatar for ddanbe
0
118

The End.