19,876 Topics
![]() | |
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 … | |
![]() | 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 :) |
[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. | |
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??? | |
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 … | |
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] … | |
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 … | |
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 :) | |
[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] | |
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 … | |
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 … | |
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. … | |
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 … | |
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 … | |
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 | |
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 … | |
I am having problems with my turbo c. its showing me that it cannot find out the include<stdio.h> file from the system. | |
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 | |
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 … | |
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. | |
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 … | |
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? … | |
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 … | |
** 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 … | |
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 … | |
why do my programs just flash off the screen when i try to execute them? i am new to programming, don't forget! | |
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 … | |
Hi could you help me ? how to implement 2 stacks with a queue in data structurs ? | |
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 … | |
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 … | |
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 … | |
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 = … | |
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. | |
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 … | |
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 … ![]() | |
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] … ![]() | |
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) ** … | |
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 * … | |
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 … | |
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] … | |
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 … | |
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. … | |
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 … | |
![]() | 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 … ![]() |
[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] | |
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 … | |
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 … | |
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 … | |
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> … | |
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) |
The End.