15,551 Topics
| |
| I can't seem to pass a struct address to a function. My program "stops working" when it gets to the scanf statement of the getReady function. [CODE]/**************************************************** Author: ---------------------------------------------------------------------- Purpose: This code will explore passing a data structure address to a function. ****************************************************/ #include <stdio> #include <stdlib> //prototypes: struct things{ … |
I want to arrange the number 1 - 12 like shown below. like the numbers on the clock. [code] 12 11 1 10 2 9 3 8 4 7 5 6 [/code] arrived with the following code: [code=c] #include<stdio.h> int main(){ int e = 11; int count = 10; int … | |
:confused: friends can you give any idea about making screensaver in c language: | |
[CODE]/* A simple server in the internet domain using TCP The port number is passed as an argument */ #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include<arpa/inet.h> #include<netdb.h> #include<string.h> int main(int argc, char *argv[]) { struct addrinfo hints,*serv,*p; int sockfd,newfd,status; struct sockaddr_storage their_addr; socklen_t addr_size; char *msg; int len; … | |
I'm a student and taking an intro to C class and would appreciate some help! I've got a file with 10 words that I've loaded into a 2D array. I've written code that will generate a random number between 0 and 9 to select a string from the array. I'm … | |
Hello! I want to make a simple game like this: [IMG]http://img340.imageshack.us/img340/6393/gamea.jpg[/IMG] So I need to start by moving the rectangles. Now I want to make an option for player VS player. I need to somehow check what keys are in "key down" state. How can I do that? (I'm using … | |
hi guys, so iam writing a program which creates a .bat file in a directory and copies it to another directory through copyfile...the problem is that while the .bat file is created properly but when it's copied to the other directory an error occurs saying its not a win32 appropriate … | |
i want to print words in reverse. i could print characters in reverse but not words for(int i=arr.length;i>0;i--) printf(arr[i]); | |
[CODE] #include<stdio.h> #include<conio.h> #include<stdio.h> void maketree(struct node**); void inorder(struct node**); struct node{ struct node *left; struct node *right; int data; } void main() { struct node *root; root=NULL; printf("Enter root"); maketree(&root); preorder(&root); getch(); } void maketree(struct node **root) { int num; struct node *temp; if(*root==NULL){ //printf("Enter number"); scanf("%d",&num); temp=(struct node*)malloc(sizeof(struct … | |
I created a dyanamic array through malloc() function. (size is 1024) next time i want to change buffersize as 500 . how can do this? | |
brothers, please teach me how to show error message when a user input non-character type value? i try myself while i use if statement, but it will show me the error message too when type character type or string type. [CODE] if(name > 0) { system("cls"); printf("\t\t============\n"); printf("\t\t ALERT! \n"); … | |
Hi all, lets say for example I have the following code [CODE]char *fname = "John"; char *lname = "Doe"; char *query = "SELECT fname, lname FROM table_name;"[/CODE] The last statement won't work, so my question is how to pass the fname and lname variables to the query? | |
Hi, We were asked to make a Binary Search Tree program in C. It should be able to traverse the numbers (preorder, inorder, postorder) then display it. And locate the number and display it. I have no probleming traversing and locating it. My problem is if the number isn't there … | |
Hi, We were asked to make a Binary Search Tree program in C. It should be able to traverse the numbers (preorder, inorder, postorder) then display it. And locate the number and display it. I have no probleming traversing and locating it. My problem is if the number isn't there … | |
Hey, I'm writing a program that takes files and renames them to include a timestamp of the current time on them in c++. I'm pretty new to c++ (and programming in general) and any help or advice would be greatly appreciated. So far I have this: When I compile it … | |
Good day all, I have this problem and have have spent quite a huge amount of time on it without any considerable progress. My problem is stated thus: I have a series of files with the extension (.msr), they contain measured numerical values of more that ten parameters which ranges … | |
1. Define a structure called cricket that will describe the following information Player name Team name Batting average Using cricket, declare an array player with 10 elements and write a program to read the information about all the 10 players and print a team wise list containing names of players … | |
b=c/d++; In this, first d is incremented (because ++ has a higher priority than / or =), but c is divided by the unincremented value of d. Thus, the order of evaluation in this case is well-defined. But if we had written the above as: b=(c)/(d++) then which operand ( … | |
Can you help me to start with them I cant find any information about them the exactly thing i need its Array of pointers where the pointers are pointing a menu like this idea below. Pls just help me with the syntax ... | |
How to do this structures, any Idea? Given a program segment as follows: #include <stdio.h> struct book { char title[80]; int bar_code; float price; } ; struct book BOOK; void INPUT (struct book *B); float DISCOUNT (struct book *B); You are required to write a complete program that includes the … | |
Pretty interesting problem about linked list. This program is about autobuses. Each autobus is given by brand, registration number, number of seats, kilometres and year when the bus was made. The program is organised as menu and when you hit number it calls some function. Problematic function: it should NOT … | |
plz help me to solve the below problem.i have done some code. MY client and server need to achieve the following requirements: 1.1. program for client needs to take two arguments that specify the name of server and the port that it is trying to connect to. Your program for … | |
I have an issue i need to get resolved fast. I cant seem to get my Dialog box to run properly. This is the code i have for it. The Problems i have are where the black arrows are. First arrow: "No matching prototype available Second and third arrow: "Invalid … | |
[CODE]void deletenode(NODE* node,int no){ if(node==NULL) return; else{ if(node->data==no){ if(node->left!=NULL && node->right==NULL) { printf("%d ",node->data); node=node->left; printf("%d ",node->data);} else if(node->left==NULL && node->right!=NULL) node=node->right; else if(node->left==NULL && node->right==NULL) node=NULL; } deletenode(node->left,no); deletenode(node->right,no); } } [/CODE] can anybody tell me what's wrong with my code? it's suppose to delete a node of a … | |
I have a program that works fine under windows, but when i run it on Unix I get a very slightly diffent set of results, followed by a 'segmentation fault' message. I'm at a loss to explain why. Any ideas? | |
I've a 2-d array declared as such [CODE]lower_tri = (float **)malloc(sizeof(float *)*(dimention)); for(i =0; i < dimention; ++i) lower_tri[i] = (float *)malloc(sizeof(float)*(i+1));[/CODE] So that it looks like... [] [][] [][][] [][][][] ... However, it causes a segmentation fault when I try to de-allocate the array with [CODE]free(lower_tri);[/CODE] (only in unix, … | |
Ok, just as my topic says, I'm having trouble why it cannot consider negative multipliers. Code below: [CODE]//Multiplication by Repeated addition #include<stdio.h> main() { int k, l, m, n; printf("Enter Multiplicand: "); scanf("%d", &k); printf("Enter Multiplier: "); scanf("%d",&l); n=0; for(m=0;m<l;m++){ n=n+k; } printf("Result is: %d", n); printf("\nThank you for using … | |
I want help in writing a C function that allows me to print a particular line in a text file. Is there a way to skip lines in a text file?? | |
Hello. I am having a little trouble with enabling and disabling word wrapping in a normal edit control. [CODE] hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL, 0, 0, 100, 100, hwnd, NULL, GetModuleHandle(NULL), NULL); // This is how my … | |
Hello, I'm just a beginner (student). Now still undergo C programming class to upgrade my knowledge in C. I was asked to complete a simple program to get the output of C program in the text file as shown below. This program is to help user to consider a range … |
The End.