19,876 Topics

Member Avatar for
Member Avatar for achava

Using a C but not a C++ compiler. We have code like this: Suppose we have code like this: [CODE]main() { int *funcko(); int *george = funcko(); printf("%d", goerge[3]); } int *funcko() { int cat[12]; return cat; }[/CODE] What happens when you try this according to the actual rules of …

Member Avatar for Narue
0
148
Member Avatar for thendrluca

Hello World! i wrote this code for fliping the array , but it doesn't work ... why can anyone say me ? what i did wrong? [B]array[/B] and [B]i,n[/B] variable are already global declared. [CODE] void exb(void) { int aux; for(i=0;i<(n-1)/2;i++) { aux=x[i]; x[i]=x[n-1-i]; x[n-1-i]=aux; } } [/CODE] thanks :)

Member Avatar for Adak
0
354
Member Avatar for swissknife007

[CODE]void quick(int a[],int m,int n) { int k,key,i,j; if(m < n) { k=(m+n)/2; swap(a[m],a[k]); key=a[m]; i=m+1; j=n; while(i<=j) { while((i<=n)&&(a[i]<=key)) i++; while((j>=m)&&(a[i]>key)) j--; if(i<j) swap(a[i],a[j]); } swap(a[m],a[j]); quick(a,m,j-1); quick(a,j+1,n); } }[/CODE] I am getting a segmentation problem in swap(a[m].a[k]); Please explain.

Member Avatar for Adak
0
141
Member Avatar for ooops.789

hello....i am trying to implement a client/server socket program in C to display the files available on the server to the client....how do i do this???

Member Avatar for L7Sqr
0
72
Member Avatar for ooops.789

hello....i am trying to establish a communication between server and client and later to do some communication between them, so first i am trying to establish communication and i see that server gives "segmentation fault" as the output. I am placing the code below, check it out and let me …

Member Avatar for ooops.789
0
3K
Member Avatar for shaneos

I'm writing a code to put names in alphabetical order. The code i've written wont compile as its teling me that 'left operand needs l value'. The lines it refers to is where i'm trying to swap around strins using pointers. I could use some help with this, thanks! [CODE] …

Member Avatar for Smeagel13
0
114
Member Avatar for mesanda

hi, i need a help for making double link list program in C double link list (file.h and file.c) in prototype insert first, insert after, insert last, delete first, delete after, and delete last. this program required in hospitaL you can email me : <email removed> (zip) i need for …

Member Avatar for mesanda
0
96
Member Avatar for karisma

Can ne1 pls help with how to subtract two large integers stored as an array. i need to do the same for calculating the jacobi symbol. thanks :)

Member Avatar for WaltP
0
420
Member Avatar for indrajeet6

[B]Hi I would like some helpful hints on how to make a program to: 1)Create a Binary tree 2)Traverse said tree in Preorder form. Thank You [/B]

Member Avatar for suyash_iiit
0
207
Member Avatar for Coldev

Hi everyone I have this project for my programming class and would appreciate it if someone could point me in the right direction. The objective of the lab is to write a C program that will be able to solve a boolean formula and print all the satisfying assignments. This …

0
61
Member Avatar for FinaL111

I have a question regarding the use of malloc and realloc: for this, "part", of my assignment, I have to read in every word from a text file and count the number of times it appears in a text file. The definition of a word in this assignment is very …

Member Avatar for NerdyChick27
0
326
Member Avatar for NerdyChick27

I have an assignment with a slightly strange implementation of priority queues using a binary tree. I'm really having trouble trying to understand how to make my insert function work when the parameters are as follows [CODE]void insert(tree t, void* item)[/CODE] where item is the data going to be inserted. …

Member Avatar for NerdyChick27
0
213
Member Avatar for mccarthy.den

hello everyone. couple of days back i started learning C (with the help of internet) i have do while loop which i can't get to work as long as i know, when i press 'y' it should again ask temperature. but it is not doing that. i am using Turbo …

Member Avatar for WaltP
0
135
Member Avatar for ooops.789

I am trying to generate a random number, but it should not be a particular number. So i am passing the number which should not be the random number and the range in which it has to be generated to the function, and i am reinvoking the function if the …

Member Avatar for cluekiller
0
230
Member Avatar for Iphicles

Hi, can anyone out help me with my assignment which is to read an image file of a maze and find an exit of it. As I'm still kinda of new @ C programming, I'm having problems even reading the image onto C. Cheers Ming

Member Avatar for timetraveller92
1
481
Member Avatar for Panathinaikos22

C is a medium level language ? i guess c++ also that's why C/C++ are faster than others, but i dont think VB/C# example are to slow like some says. That i hear exactly is: (" a ATM Software can't be in High level language VB/C#/Java because are to slow …

Member Avatar for timetraveller92
0
159
Member Avatar for stream4559

I am having problems with my turbo c. its showing me that it cannot find out the include<stdio.h> file from the system.

Member Avatar for timetraveller92
0
210
Member Avatar for s_h_a_m

hello im new in programming and i need help in printing this kind of output [CODE] * * * * * * * * * *[/CODE] the number of iterations depends on users input please help me

Member Avatar for timetraveller92
0
95
Member Avatar for Liuhh00

hey guys lol to be honest...i just got this based off of luck x.x idk how but i can't keep doing this with the rest of my programs lol this is a program for an asterick pattern any way i can improve it just by using for loops?please im open …

Member Avatar for timetraveller92
0
359
Member Avatar for Sokh

Hi everyone,Can you please help me? I want a C# code for taking time and date from a site and import this time in my program,can you pls help me.

Member Avatar for Sokh
0
274
Member Avatar for phr33k

Hi, I am new to the forum. I am stuck on this assignment I have to do. I think i have defined the array suitably enough, I just cant implement the sorting specified in the question. Any help would be greatly appreciated. Here is the question: Create a program in …

Member Avatar for dctb13
0
328
Member Avatar for dgreene1210

I wrote this program and it compiled with no errors or warnings but when i went to run it i get a segmentation fault and i cant figure out what is causing it. Ive spent hours and hours on this . Anyone with some expertise willing to take a look? …

Member Avatar for Smeagel13
0
178
Member Avatar for Panathinaikos22

Here is my code, i will also give an example... [CODE]#include <iostream> using namespace std; class Encryption { private: int wp, wk, encryption; public: Encryption() { } Encryption(int password, int key) :wp(password), wk(key) { } int Encrypt_Store() { encryption = wp + wk; cout << "Encypted: ( " << hex …

Member Avatar for xfbs
0
181
Member Avatar for tquiva

** EDIT: sorry, typo in my title. I meant to write 3 pointers instead of 2. I am trying to revise/create a function in which it is given given three pointers to floats and reorders the values pointed to into ascending order. The prototype for the function would be: void …

Member Avatar for larsake27
0
749
Member Avatar for mprabuw

Hello Dani Web Forum, I'm really new to C. I have an assignment, which I think it's very hard to solve. I have to create a Currency Converter Program that reads data from txt files. The program should also be able to read arguments (argv[]). I'm really confused since it's …

Member Avatar for mprabuw
0
784
Member Avatar for collinskawere

why do my programs just flash off the screen when i try to execute them? i am new to programming, don't forget!

Member Avatar for siskaj
0
141
Member Avatar for geeksforgeek

Hello everyone I am using bsearch() method to find whether the element is in list or not, but i don't know how to find the index of that element. here is the code which i have done:-- [CODE] #include <stdlib.h> #include <stdio.h> int arr[11] = { 10,22,37,49,51,66,68,73,75,79,81 }; int comp(const …

Member Avatar for gerard4143
0
94
Member Avatar for str91
Member Avatar for Adak
0
92
Member Avatar for maplerichie

Can i change the array's rows length after i define it as constant or any other way? Can you under my code or explanation? [CODE]#include<stdio.h> #define CLASS_SIZE 20 //First define the array rows's length void main() { double gpa, average, highest, lowest; int student, rows, i, j; char grade[CLASS_SIZE][5]; //Wish …

Member Avatar for Adak
0
214
Member Avatar for FinaL111

This may be a rather simple thing to answer, but I am no programming expert. Let me explain my problem in detail: for this homework assignment I need to open up a file with simple text in it, format it so that each line is reduced to a certain number …

Member Avatar for WaltP
0
124
Member Avatar for rohan121212

Hey i am a beginner in programming I typed the following program on my own But there are a lot of errors it it Please help me find them [CODE] #include<IOSTREAM.h> main() { int a,b,c,x; cout<<"Enter three values - \nA,B,c."; cout<<"A-"; cin>>a; cout<<"B-"; cin>>b; cout<<"c-"; cin>>c; if (a>b) x=1 else …

Member Avatar for rohan121212
0
159
Member Avatar for gman1991

using the standard function in atoi() wont work. it gives me an error that says "assignment makes pointer from integer without a cast" this is sample of the code.. [CODE]struct integer* convert_integer(char* stringInt) { struct integer* convertedInt_1; char* stringArray3 = (char *) malloc (sizeof(char));; free(stringArray3); stringArray3 = stringInt; convertedInt_1->digits = …

Member Avatar for Adak
0
195
Member Avatar for Zarl

How would i make my program a .exe so people can run it, i made a simple calculator and i want to share it with some people so they can test it out.

Member Avatar for thines01
0
84
Member Avatar for kothaisaravan

I have created a .NET windows based application in c#. Find the attached screenshot of my application. Java web service is already created and maintained. Now I want to send the values from windows application grid view to java web service. Is this possible? If so how? Am newbie to …

Member Avatar for thines01
0
216
Member Avatar for ndayala

Suppose that you have a structure defined as such. [CODE] typedef struct Deity { char name[80]; char religion[80]; int numAppendages; } Deity;[/CODE] And, suppose you have a pointer to a Diety structure. Deity* deityPtr; Assuming that at some point you allocate memory for a Deity structure, assign its address to …

Member Avatar for MonsieurPointer
0
108
Member Avatar for Ascar

Hi, I need help with this, I'm reading a txt file that has this format: 10,4,12,6,18,24,7,8,15,14,25,2 So far, I read the file using fopen ().Also, I used strtok () to split the string into tokens, but i don't know how store the tokens into an array. any ideas? thanks [CODE] …

Member Avatar for MonsieurPointer
0
642
Member Avatar for ahp@aol.in

Hi folks, I'm trying following code.. [CODE] #include<stdio.h> int calsum(int a,int b,int c); int main(){ int x,y,z,sum=0; printf("Enter the 3 numbers:\n"); scanf("%d%d%d",&x,&y,&z); sum=calsum(x,y,z); printf("The vlaue of sum is :%d\n",sum); return 0; } int calsum(int a,int b,int c){ int d=0; printf("The value of d is:%d",d); d=a+b+c; } [/CODE] ** (1) ** …

Member Avatar for D33wakar
0
175
Member Avatar for javedmirza

AOA Dear fellows i have code in which i uses linked list.when i compile that program the compiled file run but not work. I write this code in Dev c++. [CODE] #include <iostream.h> #include <string.h> #include <stdlib.h> using namespace std; class Node { public: int value; string Name; Node * …

Member Avatar for raptr_dflo
0
242
Member Avatar for cdudefire

I have been working on this code for a while and I can't seem to get to work right. I have been trying to make a credit card validator program in c for a class assignment. Any help would be welcome. [CODE]#include <stdio.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include …

Member Avatar for cdudefire
0
114
Member Avatar for YourGamerMom

I used a multi dimensional array: [CODE]int grid[3][3];[/CODE] then I assigned all the variables in the array to the number 2 like this:[CODE] grid[0][0] = 2; grid[0][1] = 2; grid[0][2] = 2; grid[1][0] = 2; grid[1][1] = 2; grid[1][2] = 2; grid[2][0] = 2; grid[2][1] = 2; grid[2][2] = 2;[/CODE] …

Member Avatar for YourGamerMom
0
99
Member Avatar for tyricec

I'm trying to make my rectangles appear on screen, but it appears blank when I run the program. [CODE]#include <GL/glut.h> #include <stdlib.h> #include <math.h> using namespace std; struct GLPoint { GLint x; GLint y; }; void init(void) { glClearColor (1.0, 1.0, 1.0, 0.0); glShadeModel (GL_SMOOTH); } void display(void) { int …

Member Avatar for tyricec
0
235
Member Avatar for ram619

This is a question from some book. When u run it u would get base address of the arguments provided that is, if u write in CMD "myprog one two three" then the address would be like 65521 n 65525 n 65529 Means equal byte consumption by all the arguments. …

Member Avatar for ram619
-1
159
Member Avatar for DmytriE

Hi all! I am having trouble accessing dynamic information. I have used the malloc command to allocate the necessary memory for my struct. However, when I leave that function and enter a display function it says there is a problem accessing the information in the struct. I just had a …

Member Avatar for D33wakar
0
115
Member Avatar for jtbens01

I've searched google and tried several different things but I can't figure out how to read strings into a two dimensional character array and also read doubles into separate arrays all from the same text file. Please provide any help you can and let me know how you might accomplish …

Member Avatar for jtbens01
0
211
Member Avatar for lllmcv

[CODE]#include <stdio.h> #include <stdlib.h> #include <math.h> float f(float x); float df(float x); int main(){ float x=-0.7; int i=0; float y; do{ printf("f(x) is %f",f(x)); y=x-(f(x)/df(x)); x=y; i=i+1; printf("repeats %d",i); printf("x is %f",x); }while (f(x)!=0); return(0);} float f(float x) { return (x+pow(exp,-10.0*pow(x,2.0))*cos(x)); } float df(x) { return ((1-20*x*exp^(-10*(x)^2)*cos(x)-exp^(-10*(x)^2)*sin(x))); }[/CODE]

Member Avatar for emrecaglarhosgo
-1
95
Member Avatar for terence193

The problem ''Ask the user to enter a year and store it in an int. Then assign to a _Bool variable the value true if the year is a leap year. The leap year is any year whose number is a multiple of four. Take into account that years whose …

Member Avatar for Narue
0
142
Member Avatar for Octet

Hello DaniWeb Users, I am new to the forum however from what I have seen it is exceptionally good! I have searched the forums already and found various questions relating to a similar problem as mine however I am unable to work out how I can amend this for my …

Member Avatar for Octet
0
216
Member Avatar for challarao

Hi.... I wrote a program for Quick Sort algorithm.... It is compiled fine....but it is giving a run time error i.e., Segmentation Fault.... I tried hard but couldn't find out what is that thing causing segmentation error in this program.... Please help.... I'm getting segmentation fault very frequently (i'm using …

Member Avatar for challarao
0
461
Member Avatar for PapaGeek

I’m trying to use an Aug20th 2005, how to set file access time, here on DaniWeb. I need to modify the file times for a “C”, not C++, Visual Studio 5, console ap that I am working on. Here is the exact code for the project: [CODE]#include <windows.h> #include <stdio.h> …

Member Avatar for PapaGeek
0
209
Member Avatar for manaila

Does USSD syntax include other characters other than "[B] * and digits[/B]". While [I]googling [/I] I have not found where it is explicitly explained. This is because I am getting ERROR while sending USSD which consists of spaces and : (column)

Member Avatar for manaila
0
86

The End.