15,552 Topics

Member Avatar for
Member Avatar for DJXiej

Here's a small snippet from my code. Following a Knuth Shuffle model in the Shuffle function, I get 6 Pointer Expected errors in line 15, but I'm sure its really 2 due to the SWAP function in the header. Now the two things I'm swapping are a random index and …

Member Avatar for histrungalot
0
449
Member Avatar for CelestialTeapot

Hi, I am trying to create a simple program to rename a bunch of files #include <stdio.h> int main(){ int count; for(count = 1; count <= 95; count++){ if(count >= 10){ system("rename \"C:\\wamp\\www\\anime\\kenshin\\Rurouni Kenshin - %d.mkv\" \"%d.mkv\"", count, count); } /* For the episodes that have 0 before the number …

Member Avatar for CelestialTeapot
0
153
Member Avatar for CKShia

Hi I am new in C programming language... I am writing a simple FTP Server-Client program, and I want to print out the client IP address for each successful login. Here's the code that I encountered warning: `struct sockaddr_in ser_addr;` `printf("IP: (%s); Port: (%d)\n",` `inet_ntoa(ser_addr.sin_addr), ntohs(ser_addr.sin_port));` When I compile the …

Member Avatar for PieterBeyens
0
190
Member Avatar for Sean Raina

Can some one help me write a c program for my "Internal Assessment" at school? Its a program that should be over 5oo lines but I need your help urgently. The dead line is two days from now. If your interested, email me at "seanraina@yahoo.com", where I will give you …

Member Avatar for bumsfeld
0
56
Member Avatar for hwoarang69

hi i have a 3 part question. can any one explain how can i read from a file and store it in array.(have to use fread). the way i was thinking of doing this was. int ar[50]; int ar2[50]; //read 20 charater at a time while(fread(ar, 1, 20, file) != …

Member Avatar for Ancient Dragon
0
130
Member Avatar for akaicewolf

So I need to write a chaining hash map. I found some examples on the internet and have a pretty clear idea on how to go about it. However the biggest problem I am having is understanding the different hash function. I have a large list of id and they …

Member Avatar for gusano79
0
181
Member Avatar for ilovephil
Member Avatar for vired

Hi! My homework is to make a c program for game of life. I have made my code already, the problem is when i'm running the code the compiler doesn't display any error, but my code still doesn't work well. I have to print in the screen an initial generation …

Member Avatar for vired
0
230
Member Avatar for ilovephil

guys im using reverse polish notation in link list my problem is every time i enter the OPERATOR (+) it will add and that operator display as '0' im having trouble in that operator i need to display it as blank >_< help me guys #include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> #define …

Member Avatar for ilovephil
0
181
Member Avatar for ilovephil

how can i make the condition if(isalpha(str)) always said that it is invalid conversion from char to int whenever i use if(isalpha(i)) does not print the "That is alpha" help me pls? #include <stdio.h> #include <stdlib.h> #include<ctype.h> #include<string.h> int main () { int i; char str[256]; printf ("Enter a number: …

Member Avatar for Adak
0
189
Member Avatar for ilovephil

how to compare str and the + sign LINE 15 please help me #include <stdio.h> #include <stdlib.h> #include<ctype.h> #include<string.h> int main () { int i; char str[256]; printf ("Enter a number: "); gets ( str ); i = atoi ( str ); if(isalpha(str[256])) { */if(strcmp(str,'+')==0) { printf("That is a plus …

Member Avatar for Adak
0
120
Member Avatar for ilovephil

Hi this is RPN i would like to ask why the free(after) does not remove the after..im still confuse but whenever i print the value of after it is the last node but when im trying to remove it doesn't. #include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> #define p printf #define s scanf …

Member Avatar for savoie
0
127
Member Avatar for rraj.be

when i try to compile this code i get ERORR: unable to open include file sdl.h [CODE]#include "stdlib.h" #include "SDL/SDL.h" // *** IF USING XCODE ON MACOS X, YOU MAY NEED TO CHANGE THE FOLLOWING LINE TO: #include "SDL_mixer/SDL_mixer.h" #include "SDL/SDL_mixer.h" //Function prototyping action! void musicFinished(); int musicPlaying = 0; …

Member Avatar for maski4real
0
516
Member Avatar for ilovephil

Why i always get the address of the number?? 2295367 >_< #include<stdio.h> #include<stdlib.h> #define p printf #define s scanf #include<ctype.h> struct node { int data; struct node *link; };typedef struct node *nodepointer; void push(nodepointer &top,int number) { nodepointer newnode,temp; newnode=(nodepointer)malloc(sizeof(struct node)); newnode->data=number; newnode->link=NULL; if(top==NULL) { top=newnode; } else { temp=top; …

Member Avatar for histrungalot
0
172
Member Avatar for tubby123

Hi, I get the error "warning: array ‘str’ assumed to have one element [enabled by default]" when I am trying to fill in values inside the string array. [CODE]#include<stdio.h> #include<string.h> #include<malloc.h> char* str[]; int i = 0; int main(void) { for(i=0;i<5;i++) str[i] = (char*)malloc(200 * sizeof(char)); strcpy(str[0],"hello"); strcpy(str[1],"my"); strcpy(str[2],"name"); strcpy(str[3],"is"); …

Member Avatar for Adak
0
1K
Member Avatar for thorpntell

I need to find the period of wave using zero crossings given a set of values that represents a sine wave... I'm a little new to C so there is a chance I made this over complicated, but... oh also, the time of the zero-crossing can be estimated as tz=(t1+t2)/2 …

Member Avatar for rubberman
0
148
Member Avatar for whitech

I have to write a code.The program compute random sentences by using singly linked list date structure.The same word cannot be used more than once. I've already written the some codes which takes the list. [CODE]// random_sentence_operator.cpp : Defines the entry point for the console application. // #include <stdio.h> #include …

Member Avatar for harinath_2007
0
114
Member Avatar for ilovephil

how can i use reverse polish notation in link list using stack i need to reverse the numbers>_< #include<stdio.h> #include<stdlib.h> #define p printf #define s scanf struct node { int data; struct node *link; };typedef struct node *nodepointer; void push(nodepointer &top,int num) { nodepointer newnode; newnode=(nodepointer)malloc(sizeof(struct node)); newnode->data=num; newnode->link=top; top=newnode; …

Member Avatar for BobS0327
0
253
Member Avatar for Oriden

I have been doing a lot of reading and digging and not able to put together a away to do this. Here is my problem. I am building a quiz program in C. I want it to pick at random from a list of questions and compare your answer to …

Member Avatar for zeroliken
0
151
Member Avatar for ilovephil

Any idea how to make restrictions in link list. im still confuse what will i need to make restrictions?? i know the isdigit isalpha etc. for example i can only enter DIGIT,

Member Avatar for ilovephil
0
276
Member Avatar for coreyhughes

I have a question for a homework assignment. This is C, not C++ (sorry! i didn't know where else to go). I have 2 character arrays, declared as char s1[100] and s2[100] in my main function. The part of this assignment I am having trouble with is the readString function. …

Member Avatar for coreyhughes
0
124
Member Avatar for ilovephil

im still confuse in RPN will i use insert at bottom of stack or front and then reverse it? cause my project say's that insert at the bottom of the stack..somebody help me pls

Member Avatar for BobS0327
0
103
Member Avatar for ilovephil

i need that every user input is character it will ask again to enter number until the user's input is correct.my program does not seems to apply the proper condition any help guys? #include<stdio.h> #include<stdlib.h> #define p printf #define s scanf #include<ctype.h> struct node { int data; struct node *link; …

Member Avatar for zeroliken
0
124
Member Avatar for Detkimble

When i try running this code i get an error 'Floating Point Exception'. I dont know why this is happening. [CODE]#include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> long long int number_of_tosses, number_of_threads, number_in_circle = 0; pthread_mutex_t mutex; void *mc(void* rank) { double x, y, distance_squared, pi_estimate; int toss; long …

Member Avatar for Detkimble
0
161
Member Avatar for angelineang

what is the problem actually in my code?when debug ,it will crash or come out same data. [CODE]#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { int col; int rand_question[3]; int confirm_question[3]; int i; int score=0; char choice; int max_question, total_question; max_question = 3; total_question = 3; srand(time(NULL)); /for(col=0 ; …

Member Avatar for WaltP
0
145
Member Avatar for tubby123

Hi, I don't understand why we typecast malloc. For example, while creating a string/character array, we normally do, [CODE]line = (char*)malloc(200 * sizeof(char));[/CODE] assume we have already declared char* line; I was just reading the malloc man pages and it says that malloc allocates that much memory and returns a …

Member Avatar for tubby123
0
163
Member Avatar for balajirs

Below is a part of an experiement. I am trying to mprotect the whole of the stack area but mprotect needs page aligned space. I can get the address of the current pointer using ucontext.uc_mcontext.gregs[REG_ESP] . But how do I get the page-size aligned address to use in the mprotect …

Member Avatar for gerard4143
0
739
Member Avatar for swissknife007

Question statement Now we represent a natural number N by the maximum numbers that are less than or equal to N in Fibonacci sequence: N = b1*A1 + b2*A2 + … Hence N can be represented as: bnbn-1…b1. For eg, 1 = 1f, 2 = 10f, etc. On writing all …

Member Avatar for Adak
0
102
Member Avatar for chirag_mittal

Hello, I was given a question a few few days back to write a program that lets a user enter a value for an angle and quadrant in which the angle lies is printed using switch statement. I was able to make this program using if-else very easily but making …

Member Avatar for chirag_mittal
0
467
Member Avatar for hwoarang69

i am reading from file called inputfile and storeing in char array line. Lets say the word in char array line is "black cat". than I am strtok word "black" and puting in ch. After that iam testing if the 1st word is black or not. Inside the if statment …

Member Avatar for hwoarang69
0
72

The End.