15,551 Topics
![]() | |
I am trying to produce a random walk solution but I get some strange results. Here's the code : [CODE] #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <time.h> int main (int argc, const char * argv[]) { // insert code here... char myArray[10][10]; char letters[26] = {'A', 'B', 'C', 'D', … | |
Hello everybody, I have spend the last 6 hours on trying to access a char * type within a static struct without success. I guess I use the pointers wrong but after trying "everything" I am pretty lost right now. So hopefuly someone of you can help me. I have … | |
my program is made to enter a matix,in which it finds all of the column`s minimum numbers which are[COLOR="Red"] >0[/COLOR] and then put them under the last row.i have sucseded entering the array and puting it out,but i think my IF is wrong somehow.I have tried initialising the last row … | |
hi everyone i need some example programs on UART in embedded c for atmega8 micro controller can anyone help me plzzzzzzz | |
[CODE]#include <stdio.h> #include <ctype.h> #include <string.h> #include <unistd.h> #include <libgen.h> #include <time.h> #include <errno.h> #include <ctype.h> #include <math.h> #include <float.h> #include <stdlib.h> static char * string_tok( char *str) { static char *next = NULL; if(str == NULL) { str = next; } else { next = str; } if(str == … | |
I have used typedef in my C programs previously many times. So it is not new to me. I was reading through a header file linux-2.6/include/net/iw_handler.h and found following use of typedef [CODE=c]typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); [/CODE]I was not able to … | |
Hi, I am using win2000 Operating system and using microsoft visual studio to develop my application and while running i am getting debug assertion failed error. | |
How is it possible to delete a byte ( char, int, double .. ) from a text file ? Suppose that the file.txt contains :"110Hello". And I want to delete "110" from the file leaving only the "Hello" part. How to do this without reading the whole file into the … | |
I am working on a control break algorithm in C, and part of this algorithm is to have while loop check for the end of file and whether two strings equal each other. the first string is a part of a typedef struct structure called 'record' [I]rec.state[/I], and the second … | |
Hi all, I want to send a file to my gmail over socket. Reading a file and writing it to socket is simple but actually I donot know how to implement SMTP over socket. Could anyone tell me how to do it ? | |
can anyone please give me c code for aging in operating system? | |
between merge sort and binary insertion sort which is more efficient?i know that theoritically both are nlogn search bt practically which will be better.that means if we plot the graph of number of comparison vs number of element in the list hose slope wll be slightly more than the other.and … | |
It's from my homework assignment Question 1) Based on the O notation, approximately how many swaps and comparisons occur when Selection sort is called on a worst-case array of length 8? a) 16 b) 64 c) 100 d) 800 Number of swaps = O(n) which is "8" and Number of … | |
Hello, I'm playing with win API functions readFile and WriteFile. Is it possible to open file using CreateFile in binary mode just like using fopen standard C function. I tried with function WriteFile to write string to a file but it seems that file is opened in textual mode. What … | |
I want to create a double pointer and make it point to an double dimension array, then output the content of the array through the pointer. However Gcc warn me that "assignment from incompatible pointer type". Just like this: [CODE]#include <stdio.h> #include <stdlib.h> int main() { int i,j; int **p; … | |
I wish to change the color of my printf statement. I use following code: [code]#include <stdio.h> #include <stdlib.h> void main() { system("color e"); printf("An enemy appears\n"); system("color c"); printf("This is an apple.\n"); }[/code] I wish to print the statement which is "An enemy appears" in yellow color and "This is … | |
Hello, i have 2 small doubts regarding pointers. 1)im trying to defererence 4 bytes as shown, and im initializiing each byte using a char pointer. But im getting runtime errors. Code [CODE] char a = 65; char *ptr = (char *)malloc(4); int *ptr1; ptr = &a; ptr1 = &a; *ptr … | |
This one is pretty strange (or at least I can't figure out what triggers it). I have the piece of code below, but there seems to be a bug with the second call of [icode]scanf[/icode]. It simply gets skipped. So the input should be something like [code] 10 3 fbfbfbfbfb … | |
hi can any1 send me the source code to the bellman-ford and djikstra routing algos please? regards, naveen. | |
Hello, It's been a few months since I haven't been able to launch Codeblock's debugger, when I launch the debugger I always get this (example): [B]Adding source dir: C:\Users\Me\Desktop\L2\SDD\TP2\ Adding file: bin\Debug\TP2.exe Starting debugger: failed[/B] I have tried: [LIST] [*]Reinstalling [*]Reinstalling (uninstall done using Revo Uninstaller) [*]Installing latest version of … | |
So I got this assignment to combine two arrays without using strcat(). The two arrays must be passed to function as parameters. The arrays need to be merged into one array in the function with dynamic memory allocation and then the new string needs to be returned back to main. … | |
I'm attempting to solve this for myself as this is homework but I can't get past the hurdle. I have an array that dynamically holds the pixels of an image (chars) in its second dimension (first being the image number). I first initialize my array variable... [CODE] unsigned char** imgSet; … | |
Am trying to write a program that read some question and answer in a text file and after displaying it in another text file and i want to make use of [COLOR="Red"]struct[/COLOR] in my program. How do i go about it using rand() to generate the question. Anyone one with … | |
Heres the assignment. 1. Declare a string, e.g. char str[81]; 2. Input a string from the keyboard (spaces included) using the (while statement while( while (str[i] = getchar() != '\n' ) adjusted so that it only inputs a certain number of characters ( in the above example that would be … | |
Would anybody be able to transform the following C code that uses while loops into C code that uses goto loops [code]while(i<10) { i++; j=0; while(j<i){ j++; printf("*"); } printf("\n"); }[/code] | |
[code=c] // ----------------------------------------------- mySquare( y1) // rcv'ing dbl = 4 { double x1=1 ;// valid, but impossible to reach. printf("\n SQRD incoming Y1: %d",y1); // shows 4 printf("\n SQRD return y1*y1: %d",y1*y1); //shows 16 x1 = (y1*y1); // ??? printf("\n SQRD return X1: %d",x1); //shows 0 ! return x1; // … | |
how do you fill an object such as a rectangle with a colour using setfillstyle(); ?? I dont want to use flood fill as i am having more problems with that.. | |
Having a problem with assigning a string in this linked list, any ideas? the line that reports an error is highlighted in red. I would expect this to work as variable 'name' is a char array and i am simply assigning the string "Vin" to it. [CODE]#include<stdlib.h> #include<stdio.h> typedef struct … | |
Hello, good afternoon. :) Now I got some problems with my "Create Payroll". I changed the "rate[100]" integer to "salrate[100]" float. After changing these errors prompted me. [b]Errors:[/b] payroll system.cpp(157,22): Illegal use of pointer <-- This is "Error" payroll system.cpp(158,8): Possible use of 'gsalary' before definition <-- This is "Warning" … | |
[CODE]#include<stdio.h> int main() { int i,j,k,c; char s[1000]; //array to store the input string for(i=0;(c=getchar())!='.';++i) //string to be ended with '.' { s[i]=c; for(j=0;j<=i;++j) { if((s[j]==s[j-1])&&(s[j]=='\n' || s[j]=='\t' ||s[j]==' ')) { j=j-1; } } for(k=0;k<=i;++k) printf("%c", s[k]); } return 0; } [/CODE] I am trying to create a program that … | |
![]() | Hey everyone, I'm working on my first program using "[COLOR=RoyalBlue]Winsock2.h[/COLOR]". I'm getting back linker errors "error LNK2001: unresolved external symbol ..." 9 unresolved externals total The program came from an MSDN tutorial: "A simple winsock program", its a simple ping program that sends packets to a loopback address. when I … |
My first post on this forum, long time lurker though. I'm running into a problem trying to search through an N-ary tree. I'm tasked with having the user input pairs of job titles and from there putting them into an N-ary tree, with the higher job titles at higher levels. … | |
I want to write and read a Student struct to/from a file. The program works weird . Sometimes reads 52 elements, sometimes 1 element. I couuld not see what the problem is. Help please. [CODE]int main() { FILE *deneme = openBinaryFile("C:\\text\\text.txt"); Student me = {"Mert","Akcakaya",200611004, 0}; Student you = {"Default", … | |
I am trying to write a program that will take a text file and parse the words into a linke dlist that will be then printed to the screen with a user defined number of characters per line and I am running into some runtime issues with opening and procesing … | |
Hello, I'm trying to work with I2C and I have the following code: [code] #include <stdio.h> #include <avr/io.h> #include <util/delay.h> #include <compat/twi.h> #define I2C_START #define MAX_TRIES #define I2C_DATA #define I2C_STOP #define i2c_writebyte unsigned char i2c_transmit(unsigned char type) { while (!(TWCR & (1 << TWINT))); return (TWSR & 0xF8); } { … | |
Greetings;) I have a conversion program with a combo box miles to kilometres kilometres to miles .... type of thing. I have two labels and two text boxes From: Says what converting from typed in To: Outputs the conversion What I want to happen is the label From to match … | |
Hi, I am reading and understanding code from a book. I am copy pasting the exact code which I have. Following program is for client.c [code=c] #include<sys/types.h> #include<sys/socket.h> #include <stdio.h> #include <sys/un.h> #include <unistd.h>> #include <stdlib.h> int main() { int sockfd; int len; struct sockaddr_un address; int result; char ch … | |
I want to generate 1billion random integer with no duplication, I dont know how do I allocate memory for such a huge amount of data. | |
So I'm doing this stack program , and basically when I try to print the elements in the stack, nothing happens... I'm totally lost : ( , any help would be appreciated. Oh and some function names are in spanish, llena means full, vacia means empty, the variable cuenta is … | |
I am having trouble taking a histogram program I made in class and making it interactive where the numbers are inputted by the user. Any help would be greatly appreciated. [CODE]#include "stdafx.h" #define SIZE 10 int main() { int n[ SIZE ]= {19, 3, 15, 7, 11, 9, 13, 5, … | |
hi i wannt ot make a programe in C inwhich user input current date and date of birth, output shows age in the number of years, months, days, etc., PLease help me!!!!!!!!!!!!!! | |
I have this: [B]foo(cons char *p);[/B] foo not is my function, and I don't have access to your source code. I'm trying use foo so: [B]char val[32]; foo(val);[/B] The result of foo is zero and not the desired string. Other tries: This work: [B]foo("something here");[/B] This don't work: [B]foo((cons char … | |
Hello, Well, this is not a question directly related to programming, so kindly excuse me for that. i have a small doubt regarding endianess and dereferencing of elements This is what i tried: [CODE]#include <stdio.h> int main(void) { int s = 0xFFFFFAFF - 1; int *p = &s; unsigned char … | |
Hello, Can I have a parallelised section of code, that uses x threads, where a function is called to manipulate an array. Each thread's function tries to manipulate the same array at the same time (not in the same location in the array). [CODE][for example, take a 2x2 matrix (x(and … | |
Hello, good evening. :) I'm having a hard time with my "Searching" codes. :( [b]The problem is:[/b] When I try to search the employee number after registering, my program will print "EMPLOYEE NUMBER NOT FOUND". I don't know where's the culprit. :( Here's the whole codes: [code=C]#include <stdio.h> #include <conio.h> … | |
Does any know about make file??? If yes, could you please explain about make file how to create make file and how to use in C,C++??? | |
hi... i'm a newbie to this community of superb IT professionals.. act i'm doing a project in image processing using c and all i wanted to kno is that,is it possible to do the image processing of a colour image without converting it to a gray scale image and then … | |
India win the match. I want to display output as match the win india. Please give me C program for this |
The End.